OpenAI Compatibility
If you've used the OpenAI API, you already know how to use THROUGHPUTS.
THROUGHPUTS is wire-compatible with the OpenAI Chat Completions and Embeddings APIs. Any client written for OpenAI — official SDKs, community libraries, LangChain, LlamaIndex, Continue, Aider — works with THROUGHPUTS by changing one line.
The one-line migration
- base_url="https://api.openai.com/v1"
+ base_url="https://api.throughputs.dev/v1"That's it. Same request shape, same response shape, same streaming format, same error codes.
Python
from openai import OpenAI
client = OpenAI(
api_key="thp_live_xxx",
base_url="https://api.throughputs.dev/v1",
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)TypeScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.THROUGHPUTS_API_KEY!,
baseURL: "https://api.throughputs.dev/v1",
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="gpt-4o",
api_key="thp_live_xxx",
base_url="https://api.throughputs.dev/v1",
)What works unchanged
- Chat completions (streaming and batch)
- Function / tool calling
- JSON mode (
response_format) - Vision (multimodal
image_urlcontent parts) - Embeddings (including adjustable
dimensions) - Rate limit semantics (
429+Retry-After) - Error shape (
{"error": {"message", "type", "code"}})
What's different
| Feature | OpenAI | THROUGHPUTS |
|---|---|---|
| Base URL | api.openai.com/v1 | api.throughputs.dev/v1 |
| API key prefix | sk- | thp_live_ / thp_test_ |
| Model availability | OpenAI only | 400+ models from every provider |
| Failover | Manual | Built-in via X-Throughputs-Model-Fallback header |
| Cost tracking | Separate API | X-Throughputs-Cost-Usd on every response |
Model names
THROUGHPUTS accepts both the provider's native slug and normalized slugs:
| Native | THROUGHPUTS |
|---|---|
gpt-4o | gpt-4o |
gpt-4o-mini | gpt-4o-mini |
claude-3-5-sonnet-20241022 | claude-3-5-sonnet (alias) |
claude-3-5-sonnet-20241022 | claude-3-5-sonnet-20241022 (full) |
gemini-1.5-pro | gemini-1.5-pro |
llama-3.1-70b-versatile | llama-3.1-70b (alias) |
Aliases are stable — THROUGHPUTS resolves them to the latest version of the underlying model. Use full slugs if you need to pin a specific version.