OhMyGPT

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:

ProtocolEndpointSDK base URLAuth header
OpenAI Chat CompletionsPOST /v1/chat/completionshttps://api.ohmygpt.com/v1Authorization: Bearer
OpenAI ResponsesPOST /v1/responseshttps://api.ohmygpt.com/v1Authorization: Bearer
Anthropic MessagesPOST /v1/messageshttps://api.ohmygpt.com (no /v1)x-api-key
GeminiPOST /v1/models/{model}:generateContenthttps://api.ohmygpt.com, API version v1x-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

EndpointPurpose
POST /v1/messages/count_tokensCount input tokens for a Claude request, free
POST /v1/embeddingsEmbeddings
POST /v1/rerankRerank documents against a query
POST /v1/images/generations, POST /v1/images/editsGenerate and edit images
POST /v1/audio/speech, POST /v1/audio/transcriptionsText to speech, speech to text
POST /v1/moderationsContent moderation
POST /v1/ocrExtract text from documents
POST /v1/decisionsTyped answers to classification questions
POST /v1/systemoneTypeSafe System One evaluations
GET /v1/modelsThe 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}:generateContent

Filter 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:

HeaderValue
X-Cost-CreditsThe charge in Credits (1 USD = 250,000 Credits). Streams carry it in the stream itself; see Streaming.
X-Request-IDThe request's ID. Use it to look the request up later, or include it when you contact support.

Your full history is in Usage.

On this page