Documentation sections
Build with Verge.
Connect to your chosen models through one API. Use your existing OpenAI SDK for chat completions, streaming, and embeddings.
https://vergeapi.com/v1OpenAI compatibleYour first request
Set up your account, choose a model, and send a message.
- Open your consoleSign in and check that your account has available credit.
- Create an API keySet its quota and permissions. Save it on your server as
VERGE_API_KEY. - Choose a modelUse the exact model ID from the live catalogue in your request.
curl https://vergeapi.com/v1/chat/completions \
-H "Authorization: Bearer $VERGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4.1-mini",
"messages": [{"role": "user", "content": "Hello, Verge!"}],
"max_tokens": 128
}'import os
from openai import OpenAI
client = OpenAI(
base_url="https://vergeapi.com/v1",
api_key=os.environ["VERGE_API_KEY"],
)
response = client.chat.completions.create(
model="openai/gpt-4.1-mini",
messages=[{"role": "user", "content": "Hello, Verge!"}],
max_tokens=128,
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://vergeapi.com/v1",
apiKey: process.env.VERGE_API_KEY,
});
const response = await client.chat.completions.create({
model: "openai/gpt-4.1-mini",
messages: [{ role: "user", content: "Hello, Verge!" }],
max_tokens: 128,
});
console.log(response.choices[0].message.content);pip install openai for Python or npm install openai for JavaScript.Keep keys on your server. Never put API keys in browser code, mobile app bundles, or a public repository. The examples read your key from a server environment variable.
Authentication
Send your Verge API key in the Authorization header with every request. Use a separate key for each application so you can manage its quota, expiry, and model permissions independently.
Authorization: Bearer $VERGE_API_KEYCreate and manage keys in your API keys page. Your account balance and the key's limits both apply to API requests.
Chat completions
Send a conversation as a messages array to POST /v1/chat/completions. Select a model with its exact catalogue ID. The first-request example above uses openai/gpt-4.1-mini.
| Parameter | Purpose |
|---|---|
| model | The model ID to use for this request. |
| messages | The conversation, with a role and content for each message. |
| max_tokens | An output-token limit, when supported by the selected model. |
| stream | Set to true to receive incremental response events. |
Read the generated text from choices[0].message.content. Image input, tools, and other model-specific capabilities depend on the model you select.
Stream a response
Add stream: true to receive the response as it is generated. With the Python client from the first example, read the content in each chunk.
stream = client.chat.completions.create(
model="openai/gpt-4.1-mini",
messages=[{"role": "user", "content": "Hello, Verge!"}],
stream=True,
max_tokens=128,
)
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="")For a direct HTTP integration, check the response status before reading the stream. Parse server-sent events until data: [DONE].
Create embeddings
Choose an embedding model and send the text as input. Embeddings use a separate endpoint from chat completions.
curl https://vergeapi.com/v1/embeddings \
-H "Authorization: Bearer $VERGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/text-embedding-3-small",
"input": "Text to embed"
}'Models and pricing
The live model catalogue shows available models, supported capabilities, and current prices. Use GET /v1/models to list the models available to your key.
curl https://vergeapi.com/v1/models \
-H "Authorization: Bearer $VERGE_API_KEY"Catalogue pricing is shown in USD. Charges can vary by input, output, cached tokens, and context length. Check a model's details before using provider-specific tools or capabilities.
Models with dynamic routing prices are not enabled until their charges can be settled accurately.
Errors and retries
Check the HTTP status and response body together. The error message explains the specific reason the request failed.
| Status | What to check |
|---|---|
| 401 · Unauthorized | Confirm the API key is valid and the Bearer header is present. |
| 403 · Forbidden | Check the key's permissions and model restrictions. |
| 429 · Limit reached | Inspect the error for a rate or quota limit. Check your key quota and account credit. |
| 5xx · Server error | For temporary failures, use a limited number of retries with increasing delays. |
Retry with care. Use bounded retries with backoff for temporary failures. Check the error before retrying an authentication, permission, or quota failure.
About Verge
Verge provides an OpenAI-compatible API, a model catalogue, application keys, usage tracking, and account controls. It is operated by Premier Global Management, LLC.
Open-source notices
This deployment adds Verge branding and configures model access through OpenRouter. Frontend design and development by New API contributors. Original project and source code. Distributed under the GNU Affero General Public License v3.0.