Skip to main content
Verlon AI provides an OpenAI-compatible API. You can use the official OpenAI SDK by pointing it to Verlon’s base URL instead of OpenAI’s.

Quick Start

Prerequisites

  • Verlon AI account (sign up)
  • An API key (it starts with sk-vrln-) from your Dashboard
  • An endpoint: a named model setup your app calls, with a model, fallback models and parameter defaults. Create one on the Endpoints page, or with verlon endpoint create --name support-summarizer --model gpt-5.4-mini. For a coding agent, follow the step-by-step setup at verlon.ai/setup.

Installation

Configuration

Point your OpenAI client at Verlon:

Making Requests

Put your endpoint’s name in model. The endpoint’s model serves, with its fallback models and parameter defaults.
A plain string, so there are no TypeScript errors and your existing code stays as it is.
No Verlon header is needed. The answer’s x-verlon-served-model header names the model that answered. A model that names none of your endpoints is refused with 404 no_endpoint_named; the message lists your endpoints and links to create one. Until launch in early December 2026, a known model id (for example gpt-5.4-mini) is also served directly, through an endpoint Verlon makes for it on first use; from launch, the model field takes an endpoint name. Older integrations that send an endpoint’s id or the X-Verlon-Gate-Id header keep working.

Responses API

Verlon also serves OpenAI’s newer Responses API at /v1/responses — the same client setup, then openai.responses.create():
When to prefer it over chat completions: tool-heavy agent loops (Responses removes chat completions’ tool-count ceiling) and reasoning models — the route passes reasoning items through verbatim, including encrypted_content, so multi-turn tool loops replay correctly. Two things to know:
  • Every provider. An endpoint whose model is on another provider gets the request translated to its API and the answer back as a Responses body; OpenAI’s reasoning items have no equivalent elsewhere and are named in x-verlon-dropped. See Any SDK, any model.
  • Stateless. store: true, previous_response_id and item_reference input items are rejected with a 400 naming the fix — send the previous response’s output items back in input each turn, exactly as you would against a stateless upstream. Verlon returns reasoning with its encrypted_content, so it replays in full.

Streaming Example

Streaming works exactly like the standard OpenAI SDK:

What’s Supported

Full support for stream: true with identical behavior to OpenAI
Works across all providers - Verlon handles format conversion
Image inputs in messages fully supported
System, user, assistant, and tool messages all supported
temperature, max_tokens, top_p, and other OpenAI parameters
Standard response.usage with token counts. Verlon adds x-verlon-* response headers (the served model, the route reason, and what was translated, emulated or dropped); each call’s cost is recorded in the request log (dashboard Logs, GET /v1/logs).

Language Examples

Migration Guide

Follow these steps to migrate an existing OpenAI application:

1. Update Client Initialization

Find where you initialize the OpenAI client and update it:

2. Call your endpoint by name

Create an endpoint with the model you use today, then put its name where the model was. From then on the endpoint decides which model serves, so you can change it in the dashboard without a deploy:

3. Update Environment Variables

.env

4. Test & Deploy

  1. Test in development
  2. Verify requests appear in Verlon dashboard
  3. Check cost tracking is working
  4. Deploy to production
Easy Rollback: If anything breaks, revert the 3 changes (baseURL, apiKey and model) - takes 30 seconds.

Advanced Usage

Multiple Endpoints

Use a different endpoint for each kind of work, each with its own model and defaults:

Environment-Specific Configuration

Error Handling

How It Works

  1. You send → OpenAI SDK request to https://api.verlon.ai/v1/chat/completions
  2. Verlon receives → Finds the endpoint named in model, applies its parameter defaults
  3. Verlon sends → Sends to the endpoint’s model (GPT, Claude, Gemini, etc.), or to its fallback models if that fails
  4. Provider responds → Returns response in provider’s format
  5. Verlon normalizes → Converts back to OpenAI format
  6. You receive → Standard OpenAI response, with x-verlon-* headers added: x-verlon-served-model names the model that answered
Your code doesn’t know the difference.

FAQ

Barely. Change baseURL and apiKey in the OpenAI client initialization, and set model to your endpoint’s name.
Yes. Just revert baseURL, apiKey and model to OpenAI values.
Yes. stream: true works exactly like OpenAI.
Yes. Set your endpoint’s model to any model — your code stays the same.
Fully supported. Verlon handles the conversion across all providers.
Yes. The Vercel AI SDK’s OpenAI adapter works with Verlon’s OpenAI-compatible API. On the Responses API (openai.responses(...)), set providerOptions: { openai: { store: false } }. By default the SDK sends earlier assistant turns back as references to items stored at OpenAI, which a stateless API can’t resolve: any request that replays a previous answer, a tool loop or a multi-turn chat, gets a 400. With store: false on a reasoning model, the SDK asks for reasoning.encrypted_content itself, so reasoning still replays in full.

Tracing your agent

To see each run of an agent as a trace — its model calls, tools, and sub-agents — and to control each call site’s model from the dashboard, add standard OpenTelemetry to this setup. There is no Verlon package to install; see Agent endpoints. Endpoints, logging, and cost tracking need nothing beyond this guide’s client setup. Video generation is served drop-in too — the async Videos surface (openai.videos.create() / retrieve() / downloadContent()) works against /v1/videos, and OCR against /mistral/v1/ocr.

Next Steps

Create an Endpoint

Choose its model, fallback models and defaults

View Request Logs

Monitor your API usage and costs

Configure Fallbacks

Learn about fallback strategies

Trace your agent

See every run with standard OpenTelemetry