OhMyGPT

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/mock model 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-Credits header.
  • 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.

ProtocolEndpointSDK base URLKey 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.comx-api-key
GeminiPOST /v1/models/{model}:generateContenthttps://api.ohmygpt.com, API version v1x-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

On this page