Overview
One API key for models from OpenAI, Anthropic, Google, DeepSeek and many more, through the SDK you already use.
OhMyGPT gives you one API key and one balance for models from OpenAI, Anthropic, Google, DeepSeek and many other providers. Keep the SDK you already use, change the base URL and the key, and switch models by changing one string:
from openai import OpenAI
client = OpenAI(base_url="https://api.ohmygpt.com/v1", api_key="sk-...")
for model in ["openai/gpt-5.4-nano", "anthropic/claude-sonnet-5-5", "zhipu/glm-5.3-flash"]:
reply = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "Say hello in one word."}],
)
print(model, reply.choices[0].message.content)- Test for free. The
ohmygpt/mockmodel answers every endpoint at no cost, so you can check your integration before spending anything. - See every charge. Each response carries its exact cost in the
X-Cost-Creditsheader. - Failover is built in. When a model has several providers and one fails before answering, OhMyGPT sends the request to another. Your code makes one call.
Base URL and protocols
The base URL is https://api.ohmygpt.com. Chat models accept all four protocols below, so you can call a Claude model through the OpenAI SDK, or a GPT model through the Anthropic SDK. The model list shows the endpoints each model accepts.
| Protocol | Endpoint | SDK base URL | Key header |
|---|---|---|---|
| OpenAI Chat Completions | POST /v1/chat/completions | https://api.ohmygpt.com/v1 | Authorization: Bearer |
| OpenAI Responses | POST /v1/responses | https://api.ohmygpt.com/v1 | Authorization: Bearer |
| Anthropic Messages | POST /v1/messages | https://api.ohmygpt.com | x-api-key |
| Gemini | POST /v1/models/{model}:generateContent | https://api.ohmygpt.com, API version v1 | x-goog-api-key |
The Anthropic SDK and Claude Code add /v1/messages to the base URL themselves. Set the base URL to https://api.ohmygpt.com, without /v1.
Start here
Quickstart
Make your first call in two minutes
Model IDs
Find the ID for the model you want
API keys
Spending limits, allowed models and rate limits
Provider routing
Choose which provider serves a model
Costs
See exactly what each request cost
Errors
Status codes and what to do about each
Claude Code
Point a coding tool at OhMyGPT
API reference
Every endpoint and parameter