Getting started
OpenAI SDK compatibility
Use the official OpenAI SDKs unchanged with api14 and migrate from OpenAI or any compatible API by changing only the base URL and key.
api14 speaks the OpenAI API. Any official OpenAI SDK, and any tool that accepts a custom OpenAI base URL, works without code changes, you only change the base URL and the API key.
The two values to change
| Setting | Value |
|---|---|
| Base URL | https://api14.com/api/v1 |
| API key | your sk-api14-... key |
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api14.com/api/v1',
apiKey: process.env.API14_API_KEY,
})
import os
from openai import OpenAI
client = OpenAI(base_url="https://api14.com/api/v1", api_key=os.environ["API14_API_KEY"])
Many SDKs also read the OPENAI_BASE_URL and OPENAI_API_KEY environment variables, so you can switch without touching code at all.
What is compatible
| OpenAI feature | api14 |
|---|---|
chat.completions.create incl. stream, tools, response_format | Supported for every text model |
responses.create | Supported |
completions.create | Supported |
embeddings.create | Supported |
images.generate | Supported (/images/generations) |
audio.speech.create | Supported |
audio.transcriptions.create | Supported (multipart) |
models.list / models.retrieve | Supported, with prices and categories |
Error shape { error: { message, type, code } } | Same, SDKs raise their normal APIError |
Endpoints that only exist at OpenAI (Assistants, Threads, fine-tuning, files, batches, vector stores and moderations) are not available.
Migrating from OpenAI
- Set the base URL to
https://api14.com/api/v1and use your api14 key. - Prefix model names with the provider:
gpt-5-minibecomesopenai/gpt-5-mini,text-embedding-3-smallbecomesopenai/text-embedding-3-small. - That's it. You can now also switch to any other provider by changing the model id, for example
anthropic/claude-sonnet-4.5orgoogle/gemini-2.5-pro.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.chat.completions.create({
"model": "openai/gpt-5-mini",
"messages": [
{
"role": "user",
"content": "Explain vector databases in two sentences."
}
]
});
console.log(result.choices[0].message.content);
Migrating from another OpenAI-compatible API
Change the base URL and the key:
- Set the base URL to
https://api14.com/api/v1. - Use your api14 key as the API key.
- Use model ids in
provider/modelformat (for exampleopenai/gpt-5-mini). Variants (:free,:online,:nitro,:floor),providerrouting,modelsfallbacks,reasoning,plugins,transformsandusageare supported.
Differences to know about:
- Billing is a USD balance.
GET /creditsreturnstotal_creditsandtotal_usagein USD, plus abalance_usdfield. See Balance & key info. - Usage cost is always included. The gateway always asks the upstream for
usage.cost, so every response reports its price. - Headers such as
HTTP-RefererandX-Titleare set by the gateway; you do not need to send them. - Video job URLs point back at api14 (
/api/v1/videos/{id}), never at the upstream. See Video.
Extra gateway parameters in the SDKs
Fields that the OpenAI SDK does not know about can still be sent:
await client.chat.completions.create({
model: 'openai/gpt-5-mini',
messages: [{ role: 'user', content: 'Hi' }],
// @ts-expect-error api14 extension
provider: { sort: 'price' },
})
client.chat.completions.create(
model="openai/gpt-5-mini",
messages=[{"role": "user", "content": "Hi"}],
extra_body={"provider": {"sort": "price"}},
)
See Provider routing & fallbacks, Reasoning and Web search.