API Reference
One base URL and one key for every model, over the OpenAI, Anthropic, and Gemini protocols.
With one OhMyGPT key you can call every model in the catalog through the OpenAI, Anthropic, or Gemini protocol. Keep the SDK your project already uses and change two settings: the base URL and the key. Create a key at API keys.
Test your integration for free with ohmygpt/mock. It answers on every chat endpoint, streaming or not:
curl https://api.ohmygpt.com/v1/chat/completions \
-H "Authorization: Bearer $OHMYGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "ohmygpt/mock", "messages": [{"role": "user", "content": "ping"}]}'{
"id": "chatcmpl-ohmygpt-mock",
"object": "chat.completion",
"model": "mock",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "This is a mock reply from OhMyGPT. Your integration works; switch to a real model when ready."
}
}
],
"usage": { "prompt_tokens": 15, "completion_tokens": 17, "total_tokens": 32 }
}When it works, change model to a real model ID.
Chat protocols
Every chat model answers on all four protocols. Use the one your SDK or tool speaks:
| Protocol | Endpoint | SDK base URL | Auth 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 (no /v1) | x-api-key |
| Gemini | POST /v1/models/{model}:generateContent | https://api.ohmygpt.com, API version v1 | x-goog-api-key |
Authorization: Bearer and x-api-key work on every endpoint, so each SDK's default header is accepted. x-goog-api-key works on the Gemini endpoints. Send the key in one header only.
Protocols shows what you send and get back when you call a model on each protocol.
Other endpoints
| Endpoint | Purpose |
|---|---|
POST /v1/messages/count_tokens | Count input tokens for a Claude request, free |
POST /v1/embeddings | Embeddings |
POST /v1/rerank | Rerank documents against a query |
POST /v1/images/generations, POST /v1/images/edits | Generate and edit images |
POST /v1/audio/speech, POST /v1/audio/transcriptions | Text to speech, speech to text |
POST /v1/moderations | Content moderation |
POST /v1/ocr | Extract text from documents |
POST /v1/decisions | Typed answers to classification questions |
POST /v1/systemone | TypeSafe System One evaluations |
GET /v1/models | The model catalog; no key needed |
For these endpoints, use a model that lists the endpoint in GET /v1/models, as shown below.
Find a model for an endpoint
Look model IDs up instead of hard-coding them; the catalog changes often. Each entry in GET /v1/models lists the endpoints that model accepts in protocols:
curl -s https://api.ohmygpt.com/v1/models \
| jq -r '.data[] | select(.id | test("claude-haiku")) | [.id, ([.protocols[].path] | join(" "))] | @tsv'anthropic/claude-haiku-4-5 /v1/chat/completions /v1/responses /v1/messages /v1/models/{id}:generateContent
anthropic/claude-haiku-5-5 /v1/chat/completions /v1/responses /v1/messages /v1/models/{id}:generateContentFilter by product type with ?service=, for example embedding, rerank, image, tts, stt, moderation, or ocr:
curl -s "https://api.ohmygpt.com/v1/models?service=embedding" | jq -r '.data[].id'Prices for every model are on Models.
The charge on every response
Every response tells you exactly what the request cost:
| Header | Value |
|---|---|
X-Cost-Credits | The charge in Credits (1 USD = 250,000 Credits). Streams carry it in the stream itself; see Streaming. |
X-Request-ID | The request's ID. Use it to look the request up later, or include it when you contact support. |
Your full history is in Usage.