> ## Documentation Index
> Fetch the complete documentation index at: https://docs.redpill.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate from OpenAI

> Switch from OpenAI in minutes and keep your SDK and code.

## Why migrate

* **Same API**: a drop-in replacement. Keep your OpenAI SDK and code.
* **Attested gateway**: requests are served through a TEE gateway that signs a receipt for every response.
* **More models**: not just OpenAI. Also Anthropic, Google, Meta, and confidential (`is_tee`) models.
* **Verifiable**: cryptographic attestation and signed receipts you can check yourself.

## Migration Steps

<Steps>
  <Step title="Get an API Key">
    Sign up at [redpill.ai](https://www.redpill.ai/register) and get API key from [dashboard](https://www.redpill.ai/dashboard)
  </Step>

  <Step title="Update Base URL">
    Change base URL from OpenAI to RedPill:

    ```python theme={null}
    # Before
    client = OpenAI(api_key="sk-...")

    # After
    client = OpenAI(
        api_key="YOUR_REDPILL_KEY",
        base_url="https://api.redpill.ai/v1"  # Add this line
    )
    ```
  </Step>

  <Step title="Test">
    Make a test request - everything else stays the same!
  </Step>
</Steps>

## Code Changes

### Python

```python theme={null}
# Before (OpenAI)
from openai import OpenAI
client = OpenAI(api_key="sk-...")

# After (RedPill)
from openai import OpenAI
client = OpenAI(
    api_key="YOUR_REDPILL_KEY",
    base_url="https://api.redpill.ai/v1"
)

# All other code stays identical!
response = client.chat.completions.create(...)
```

### JavaScript

```javascript theme={null}
// Before
const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY
});

// After
const client = new OpenAI({
  apiKey: process.env.API_KEY,
  baseURL: 'https://api.redpill.ai/v1'  // Add this line
});
```

### Go

```go theme={null}
// Before
config := openai.DefaultConfig(apiKey)

// After
config := openai.DefaultConfig(apiKey)
config.BaseURL = "https://api.redpill.ai/v1"  // Add this line
```

## Environment Variables

Update your `.env` file:

```bash theme={null}
# Before
OPENAI_API_KEY=sk-...

# After
API_KEY=sk-...
REDPILL_BASE_URL=https://api.redpill.ai/v1
```

## What stays the same

* All SDK methods
* Request and response format
* Streaming
* Function calling
* Vision
* Embeddings
* Error handling

## What's new

* **Attested gateway**: every response carries a signed receipt.
* **More providers**: Anthropic, Google, Meta, and more, through one endpoint.
* **Attestation**: verify which TEE workload served you.
* **Confidential models**: `is_tee` models run on a verified upstream enclave.

## Model Mapping

| OpenAI Model    | RedPill Equivalent               |
| --------------- | -------------------------------- |
| `gpt-4`         | `openai/gpt-4` (same)            |
| `gpt-5`         | `openai/gpt-5` (same)            |
| `gpt-3.5-turbo` | `openai/gpt-3.5-turbo` (same)    |
| -               | `z-ai/glm-5` (verified provider) |
| -               | `anthropic/claude-sonnet-4.5`    |

<Info>
  All OpenAI models work identically on the platform, plus 200+ additional models!
</Info>

## Pricing

The platform charges the **same price** as OpenAI, with TEE protection included at no extra cost.

## Gradual Migration

Test with a few requests first:

```python theme={null}
# Use RedPill for testing
test_client = OpenAI(
    api_key="REDPILL_KEY",
    base_url="https://api.redpill.ai/v1"
)

# Keep OpenAI for production (temporarily)
prod_client = OpenAI(api_key="OPENAI_KEY")

# Switch when confident
```

## Checklist

* [ ] Get an API key
* [ ] Update environment variables
* [ ] Change base URL in code
* [ ] Test with sample requests
* [ ] Monitor usage/costs
* [ ] Full migration

<Card title="Get Started" icon="rocket" href="/get-started/quickstart">
  Start using the platform now →
</Card>
