What an OpenAI-compatible API means in practice
An OpenAI-compatible API accepts the same request and response shapes as OpenAI's Chat Completions endpoint: a model string, a messages array, optional tools, response_format, stream and the usual sampling parameters. Because the contract is identical, the official OpenAI SDKs for Python and Node.js, LangChain, LlamaIndex, the Vercel AI SDK and most agent frameworks work without code changes. You only change two values: the base URL and the API key.
FastInfra exposes 714 models behind that single contract — Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, Grok, GLM, Llama and many open-weight models — so switching models is a one-string change in model, not a new SDK, a new account or a new invoice.
Switch in two lines
Set base_url to https://api.fastinfra.ai/v1, use your FastInfra key, and keep everything else.
from openai import OpenAI
client = OpenAI(base_url="https://api.fastinfra.ai/v1", api_key="YOUR_FASTINFRA_KEY")
resp = client.chat.completions.create(
model="deepseek/deepseek-v4-flash",
messages=[{"role": "user", "content": "Summarise this ticket in one line."}],
)
print(resp.choices[0].message.content)Streaming (stream=True), tool calling, JSON mode and vision inputs follow the OpenAI format for models that support them. GET /models returns every model ID you can call, with the same response schema as OpenAI's model list.
Live prices for popular models
Prices below come from the live catalog and are charged per million tokens from prepaid credits. Each row links to the model's page with specs, a cost calculator and code samples.
| Model | Input $/1M | Output $/1M | Routes |
|---|---|---|---|
Claude Opus 5anthropic/claude-opus-5 | $5.4 | $27 | 1 |
Claude Sonnet 5anthropic/claude-sonnet-5 | $2.16 | $10.8 | 1 |
Claude Haiku 5.5anthropic/claude-haiku-5.5 | $0.108 | $0.54 | 1 |
Claude Fable 5.1anthropic/claude-fable-5.1 | $10.8 | $54 | 1 |
GPT-5.5openai/gpt-5.5 | $5.4 | $32.4 | 1 |
GPT-6 Solopenai/gpt-6-sol | $2.16 | $10.8 | 1 |
GPT-OSS 120Bgpt-oss-120b | $0.0302 | $0.1102 | 5 |
Gemini 3.8 Flashgoogle/gemini-3.8-flash | $0.81 | $4.05 | 1 |
DeepSeek V4 Prodeepseek/deepseek-v4-pro | $1.728 | $3.456 | 2 |
DeepSeek V4 Flashdeepseek/deepseek-v4-flash | $0.0983 | $0.1966 | 2 |
Qwen3.6 27Bqwen/qwen3.6-27b | $0.486 | $2.916 | 2 |
Kimi K3moonshotai/kimi-k3 | $0.2074 | $16.2 | 3 |
Grok 4.7x-ai/grok-4.7 | $2.16 | $6.48 | 1 |
GLM 5.3glm-5.3 | $0.0864 | $3.888 | 4 |
Llama 4 Maverickmeta-llama/llama-4-maverick | $0.2025 | $0.7047 | 1 |
Why teams use one compatible API instead of several SDKs
- No lock-in. Swap between providers by changing the model ID; prompts, parsing and retries stay the same.
- One bill. Every model draws from the same prepaid wallet, with per-request usage in the dashboard.
- Routing and failover. Each model ID has live upstream routes. Requests go to the lowest-cost healthy route and fail over automatically when one degrades.
- Free tier for development. 12 models are available at $0 so you can build and test before you spend.
Compatibility checklist before you migrate
- Replace the base URL and key in your environment variables.
- Map each OpenAI model to its equivalent (for example GPT-5.5 stays
openai/gpt-5.5; a cheaper default could bedeepseek/deepseek-v4-flash). - Check
max_tokensagainst the model's output limit on its model page. - Keep your retry logic: rate-limit responses use the standard 429 status and error shape.
- Watch the first day of usage in the dashboard and compare cost per request against your previous provider.