One API for ChatGPT, Claude, Gemini and more models. If your code already works with the OpenAI API — just change base_url and the key; everything else stays the same.
Base URL of the OpenAI-compatible API:
base url
https://api.cheapai.io/v1The model is specified in the model field of the request — gpt-4o, claude-3-5-sonnet, gemini-1-5-pro etc. Full list on the Model catalog page.
curl
curl https://api.cheapai.io/v1/chat/completions \
-H "Authorization: Bearer $CHEAPAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'python (openai sdk)
from openai import OpenAI
client = OpenAI(
base_url="https://api.cheapai.io/v1",
api_key="cai-...",
)
resp = client.chat.completions.create(
model="claude-3-5-sonnet",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)Streaming, parameters, endpoints and more language examples are next: OpenAI-compatible API.
Any tool where you can set a base URL — CLI agents, IDE extensions, libraries — works through the gateway without a VPN. Ready-made guides:
Two env vars — and the agent runs through cheapai.io.
An OpenAI-compatible provider in config.toml.
Cursor, Cline, Roo Code, Continue, Aider, LangChain.
/v1/chat/completions and /v1/embeddings behave like OpenAI — change one URL and you're done.ANTHROPIC_BASE_URL for Claude Code).stream: true — response arrives in chunks as SSE, just like with the provider.usage with the token count; the exact request cost is in the usage history in your account.