# Migrating from OpenAI

Source: https://staging-docs.aiand.com/migrating-openai/

The ai& Inference API is wire-compatible with the OpenAI Chat Completions, Responses, and Models APIs. If you have an OpenAI integration already, you can usually migrate by changing the **base URL** and the **API key**.

<Aside type="note">
  You will be calling open-weight models hosted on ai& infrastructure — not OpenAI's proprietary models. Pick a model from the [Catalog](/models/catalog/) that fits your workload.
</Aside>

## Change two things

<Tabs>
<TabItem label="Python">

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.aiand.com/v1",
    api_key="sk-your-aiand-api-key",
)
```

</TabItem>
<TabItem label="Node.js">

```ts

const client = new OpenAI({
  baseURL: "https://api.aiand.com/v1",
  apiKey: "sk-your-aiand-api-key",
});
```

</TabItem>
</Tabs>

Everything else — `chat.completions.create`, streaming, tool calls, structured outputs — works as-is.

## Supported endpoints

| OpenAI endpoint | ai& path | Notes |
|-----------------|----------|-------|
| `/v1/chat/completions` | [Chat Completions](/api/chat-completions/) | Full parity |
| `/v1/models` | [Models](/api/models/) | Returns models your org has access to |
| `/v1/files` | [Files](/api/files/) | Same multipart upload shape |
| `/v1/uploads` | [Uploads](/api/uploads/) | Chunked uploads for large files |

## What's different

- **API keys** start with `sk-` like OpenAI's but are issued by ai& — see [Authentication](/authentication/).
- **Model IDs** differ. List them with `client.models.list()` or see the [catalog](/models/catalog/).
- **Org scoping** — pass `X-Org-ID` when using JWT auth. API keys carry their org automatically.

<Aside type="tip">
  No code change needed for streaming, tool calls, vision, or structured outputs — they're all OpenAI-shape on the wire.
</Aside>
