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

# OpenAI

> Every OpenAI model Verlon supports — plus quickstart and SDK compatibility (use the OpenAI SDK unchanged against Verlon).

Every OpenAI model — GPT-3.5, GPT-4, GPT-4o, GPT-5, and the o-series reasoning models — is routable through Verlon with your existing OpenAI SDK unchanged. Just point `baseURL` at Verlon and swap the API key.

## Chat models

| Model ID | Type | Context |
| - | - | - |
| `chat-latest` | chat | 1000K |
| `gpt-3.5-turbo` | chat | 16K |
| `gpt-3.5-turbo-0125` | chat | 16K |
| `gpt-3.5-turbo-16k` | chat | 16K |
| `gpt-4` | chat | 8K |
| `gpt-4-0613` | chat | 8K |
| `gpt-4-turbo` | chat | 128K |
| `gpt-4-turbo-2024-04-09` | chat | 128K |
| `gpt-4.1` | chat | 1048K |
| `gpt-4.1-2025-04-14` | chat | 1048K |
| `gpt-4.1-mini` | chat | 1048K |
| `gpt-4.1-mini-2025-04-14` | chat | 1048K |
| `gpt-4.1-nano` | chat | 1048K |
| `gpt-4.1-nano-2025-04-14` | chat | 1048K |
| `gpt-4o` | chat | 128K |
| `gpt-4o-2024-05-13` | chat | 128K |
| `gpt-4o-2024-08-06` | chat | 128K |
| `gpt-4o-2024-11-20` | chat | 128K |
| `gpt-4o-mini` | chat | 128K |
| `gpt-4o-mini-2024-07-18` | chat | 128K |
| `gpt-5-nano` | chat | 128K |
| `gpt-5-nano-2025-08-07` | chat | 128K |
| `gpt-5-search-api` | chat | 128K |
| `gpt-5-search-api-2025-10-14` | chat | 128K |
| `gpt-5.1` | chat | 128K |
| `gpt-5.1-2025-11-13` | chat | 128K |
| `gpt-5.2` | chat | 128K |
| `gpt-5.2-2025-12-11` | chat | 128K |
| `gpt-5.4` | chat | 128K |
| `gpt-5.4-2026-03-05` | chat | 128K |
| `gpt-5.4-mini` | chat | 128K |
| `gpt-5.4-mini-2026-03-17` | chat | 128K |
| `gpt-5.4-nano` | chat | 128K |
| `gpt-5.4-nano-2026-03-17` | chat | 128K |
| `gpt-5.5` | chat | 1000K |
| `gpt-5.5-2026-04-23` | chat | 1000K |
| `gpt-5.6-luna` | chat | 1049K |
| `gpt-5.6-sol` | chat | 1049K |
| `gpt-5.6-terra` | chat | 1049K |
| `gpt-6-astra` | chat | 1050K |
| `gpt-6-luna` | chat | 1050K |
| `gpt-6-sol` | chat | 1050K |
| `gpt-6.1-sol` | chat | 1050K |
| `o1` | chat | 200K |
| `o1-2024-12-17` | chat | 200K |
| `o3` | chat | 200K |
| `o3-2025-04-16` | chat | 200K |
| `o3-mini` | chat | 200K |
| `o3-mini-2025-01-31` | chat | 200K |
| `o4-mini` | chat | 200K |
| `o4-mini-2025-04-16` | chat | 200K |

> [!NOTE]
>
> This table is auto-generated from the Verlon model registry on every sync —
> see the [live registry](https://docs.verlon.ai/provider-compatibility/models.md#live-registry) for
> pricing, benchmarks, and deprecation dates. Any model listed here is available
> today.

## Other modalities

* **audio** — 9 models
* **embeddings** — 3 models
* **image generation** — 9 models
* **moderation** — 2 models
* **speech-to-text** — 7 models
* **text-to-speech** — 7 models
* **video generation** — 2 models

Non-chat OpenAI models are called through the same OpenAI SDK using the same model IDs — Verlon mirrors `/v1/embeddings`, `/v1/images/generations`, and `/v1/audio/speech` as drop-in routes. Video generation is drop-in too: the `openai` package's async Videos surface (`videos.create()` / `retrieve()` / `downloadContent()`) works against `/v1/videos`.

## Quickstart

> [!NOTE]
>
> First time? [Create a gate](https://docs.verlon.ai/platform/gates.md) and grab an [API
> key](https://docs.verlon.ai/getting-started/authentication.md) — the examples below need a `GATE_ID`
> and `VERLON_API_KEY`.

The fastest path — the official OpenAI SDK, pointed at Verlon:

```typescript theme={null}
import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://api.verlon.ai/v1',
  apiKey: process.env.VERLON_API_KEY,
});

// @ts-ignore - gateId is a Verlon AI extension
const response = await openai.chat.completions.create({
  gateId: process.env.GATE_ID,
  model: 'gpt-4o', // optional — overrides the gate's configured model
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.choices[0].message.content);
```

Any chat model from the table above works — swap `gpt-4o` for `gpt-5.4`, `o4-mini`, `o1-preview`, or any other ID.

## SDK compatibility

Verlon exposes an OpenAI-compatible endpoint. The official OpenAI SDK works unchanged — you swap two lines and every model in the table above becomes callable via the SDK you already know.

### Configuration — just two lines

```typescript Before theme={null}
import OpenAI from 'openai';

const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});

```

```typescript After (Verlon) theme={null}
import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://api.verlon.ai/v1', // ← add this
  apiKey: process.env.VERLON_API_KEY,  // ← change this
});
```

### Specifying your gate

Verlon supports three ways to point a request at a gate:

> [tab] Using gateId (Recommended)
>
> ```typescript theme={null}
> // @ts-ignore - gateId is a Verlon AI extension
> const response = await openai.chat.completions.create({
>   gateId: process.env.GATE_ID,
>   messages: [{ role: 'user', content: 'Hello!' }],
> });
> ```
>
> > [!NOTE]
> >
> > Requires `@ts-ignore` in TypeScript, but the clearest intent.

> [tab] Using model field
>
> ```typescript theme={null}
> const response = await openai.chat.completions.create({
>   model: process.env.GATE_ID, // gate UUID in the model slot
>   messages: [{ role: 'user', content: 'Hello!' }],
> });
> ```
>
> > [!TIP]
> >
> > No TypeScript errors, drop-in with existing code.

> [tab] Using a default header
>
> ```typescript theme={null}
> const openai = new OpenAI({
>   baseURL: 'https://api.verlon.ai/v1',
>   apiKey: process.env.VERLON_API_KEY,
>   defaultHeaders: { 'X-Verlon-Gate-Id': process.env.GATE_ID },
> });
>
> // Every subsequent call inherits the gate
> const response = await openai.chat.completions.create({
>   messages: [{ role: 'user', content: 'Hello!' }],
> });
> ```
>
> > [!TIP]
> >
> > Cleanest for TypeScript — set once, use everywhere.

### Streaming

Identical behavior to the OpenAI SDK — `stream: true` returns an async iterable.

```typescript theme={null}
const stream = await openai.chat.completions.create({
  gateId: process.env.GATE_ID,
  messages: [{ role: 'user', content: 'Tell me a joke.' }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}
```

### Language coverage

```typescript TypeScript theme={null}
import OpenAI from 'openai';

const openai = new OpenAI({
baseURL: 'https://api.verlon.ai/v1',
apiKey: process.env.VERLON_API_KEY,
});

const response = await openai.chat.completions.create({
gateId: process.env.GATE_ID,
messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.choices[0].message.content);

```

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.verlon.ai/v1",
    api_key=os.environ["VERLON_API_KEY"],
)

response = client.chat.completions.create(
    model=os.environ["GATE_ID"],
    messages=[{"role": "user", "content": "Hello!"}],
)

print(response.choices[0].message.content)
```

```bash cURL theme={null}
curl https://api.verlon.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $VERLON_API_KEY" \
  -d '{
    "gateId": "'"$GATE_ID"'",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

### What's supported

> [accordion] Streaming
>
> Full support for `stream: true`, identical semantics to OpenAI.

> [accordion] Tool / function calling
>
> Fully supported. Verlon translates across providers if your gate routes to
> Claude, Gemini, etc.

> [accordion] Vision
>
> Image inputs (`type: 'image_url'`) work with any vision-capable model.

> [accordion] Standard parameters
>
> `temperature`, `max_tokens`, `top_p`, `frequency_penalty`,
> `presence_penalty`, `logprobs`, and the rest — all passed through.

> [accordion] Usage + cost tracking
>
> Standard `response.usage` with token counts, plus Verlon's `cost` field with
> per-call dollar amount.

## Responses API

Verlon is also a drop-in for OpenAI's **Responses API** (`client.responses.create`) — the surface the OpenAI Agents SDK and multi-turn tool loops with encrypted reasoning replay are built on. Point `baseURL` at Verlon and pass your gate id as `model`, exactly like chat completions.

```python theme={null}
from openai import OpenAI

client = OpenAI(base_url="https://api.verlon.ai/v1", api_key="sk-vrln-...")

resp = client.responses.create(
    model="<your-gate-id>",
    input=[{"role": "user", "content": "What's the weather in Tokyo?"}],
    tools=[weather_tool],
)
```

> [!NOTE]
>
> **Multi-turn tool loops with reasoning replay work.** On each turn, echo the
> prior `reasoning` and `function_call` items back in `input` — Verlon requests
> `include: ['reasoning.encrypted_content']` for reasoning models and passes the
> encrypted reasoning through untouched, so the model keeps its chain of thought
> across tool calls.

> [accordion] Stateless only (v1)
>
> `store: true` and `previous_response_id` are **not** supported — Verlon
> holds no server-side conversation state (matching our zero-data-retention
> default). Send the full `input` each turn, echoing prior `reasoning` /
> `function_call` items back. Requests using `store: true` or
> `previous_response_id` return `400`.

> [accordion] OpenAI-backed gates only
>
> The Responses API is OpenAI-specific. A gate that resolves to Anthropic,
> Google, or Mistral returns `400` — use `/v1/chat/completions` for those,
> which normalizes tool calls across providers.

> [accordion] Streaming
>
> `stream: true` returns the named-event SSE stream (`event:
>         response.created`, `response.output_text.delta`, `response.completed`, …)
> verbatim.

## Migrating an existing OpenAI app

**1. Update client initialization**

Swap `baseURL` + `apiKey`. Two lines.

**2. Add a gate reference**

Pass `gateId` (or set the default header). The `model` field, `messages`,
and everything else stay the same.

**3. Test in development**

Verify requests appear in the Verlon dashboard and cost tracking works.

**4. Deploy**

Ship. If anything breaks, revert the two-line diff — takes 30 seconds.

## How it works

1. **You send** an OpenAI-format request to `https://api.verlon.ai/v1/chat/completions`
2. **Verlon receives** — validates the gate, applies routing rules
3. **Verlon routes** to whichever model your gate points at (GPT, Claude, Gemini, Mistral, or anything else in the registry)
4. **The provider responds** in its native format
5. **Verlon normalizes** back to OpenAI format
6. **You receive** a standard OpenAI response with an added `cost` field

Your code doesn't know the difference.

## Errors

Errors come back OpenAI-shaped — `{ "error": { "message", "type", "code", "param" } }` — so the OpenAI SDK's error classes work unchanged.

| Status | Meaning | What to check |
| - | - | - |
| `400` | Invalid request | Malformed body or missing `gateId` |
| `401` | Invalid API key | Your `VERLON_API_KEY` value and the `Authorization: Bearer` header |
| `404` | Gate not found | Your `GATE_ID` — the error message names the offending ID |
| `429` | Rate limit exceeded | Back off and retry; the body includes `reset_at`, and every response carries `X-RateLimit-*` headers |

```typescript theme={null}
try {
  const response = await openai.chat.completions.create({
    gateId: process.env.GATE_ID,
    messages: [{ role: 'user', content: 'Hello!' }],
  });
} catch (error) {
  if (error.status === 404) {
    console.error('Gate not found — check GATE_ID');
  } else if (error.status === 429) {
    console.error('Rate limited — retry after the reset');
  } else {
    throw error;
  }
}
```

## FAQ

> [accordion] Do I need to change my request code?
>
> No. Change `baseURL` + `apiKey` in the client. The completion calls stay
> identical.

> [accordion] Can I still call OpenAI directly?
>
> Yes. Revert `baseURL` + `apiKey` to OpenAI values and you're back on their
> API.

> [accordion] Can I route a Claude or Gemini model through the OpenAI SDK?
>
> Yes — that's the point. Configure your gate to route to any model in the
> [registry](https://docs.verlon.ai/provider-compatibility/models.md) and your OpenAI SDK code stays
> the same.

> [accordion] Does the Vercel AI SDK work?
>
> Yes. Its OpenAI adapter works against Verlon's endpoint unchanged.

> [accordion] Do I need the Verlon SDK?
>
> No. This whole guide uses only the OpenAI SDK.

## Full non-chat model list

Every non-chat OpenAI model Verlon routes to, grouped by modality. Chat models are in the table near the top of this page.

### Audio

| Model ID |
| - |
| `gpt-4o-mini-transcribe` |
| `gpt-4o-mini-transcribe-2025-03-20` |
| `gpt-audio` |
| `gpt-audio-1.5` |
| `gpt-audio-2025-08-28` |
| `gpt-audio-mini` |
| `gpt-audio-mini-2025-10-06` |
| `gpt-audio-mini-2025-12-15` |
| `gpt-realtime-translate` |

### Embeddings

| Model ID |
| - |
| `text-embedding-3-large` |
| `text-embedding-3-small` |
| `text-embedding-ada-002` |

### Image generation

| Model ID |
| - |
| `chatgpt-image-latest` |
| `gpt-image-1-mini` |
| `gpt-image-1.5` |
| `gpt-image-2` |
| `gpt-image-2-2026-04-21` |
| `gpt-image-2.5-flare` |
| `gpt-image-2.5-flare-2026-09-08` |
| `gpt-image-2.5-sunburst` |
| `gpt-image-2.5-sunburst-2026-09-08` |

### Moderation

| Model ID |
| - |
| `omni-moderation-2024-09-26` |
| `omni-moderation-latest` |

### Speech-to-text

| Model ID |
| - |
| `gpt-4o-mini-transcribe-2025-12-15` |
| `gpt-4o-transcribe` |
| `gpt-4o-transcribe-diarize` |
| `gpt-live-transcribe` |
| `gpt-realtime-whisper` |
| `gpt-transcribe` |
| `whisper-1` |

### Text-to-speech

| Model ID |
| - |
| `gpt-4o-mini-tts` |
| `gpt-4o-mini-tts-2025-03-20` |
| `gpt-4o-mini-tts-2025-12-15` |
| `tts-1` |
| `tts-1-1106` |
| `tts-1-hd` |
| `tts-1-hd-1106` |

### Video generation

| Model ID |
| - |
| `sora-2` |
| `sora-2-pro` |

## Related

* [Anthropic](https://docs.verlon.ai/provider-compatibility/anthropic.md) · [Google](https://docs.verlon.ai/provider-compatibility/google.md) · [Mistral](https://docs.verlon.ai/provider-compatibility/mistral.md)
* [Verlon SDK reference](https://docs.verlon.ai/sdk-reference/overview.md) — agent tracing, observability, and the model registry
* [Gates](https://docs.verlon.ai/platform/gates.md) — set up routing rules and model configuration
* [Bring your own key](https://docs.verlon.ai/platform/byok.md) — use your own OpenAI account for provider costs
* [OpenAI's official docs ↗](https://platform.openai.com/docs)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.