How-to · 23 Oct
How-to · 3 min read
How to call Claude, GPT and Gemini from one API key
You are building something that calls a language model, and you want to try Claude, GPT and Gemini side by side without wiring up three providers. Right now that means three accounts, three API keys in your environment file, three billing pages and three slightly different client libraries. Every time a new model ships you start that setup again. You just want to change one string in your code and see which model answers better.
- Published
- 17 Nov 2026
- Delivery
- No. 12
- Topic
- AI and agents
- Evidence
- 9 claims quoted from somnus.world
01
Why it's hard
Each AI company runs its own API with its own key, its own request format and its own dashboard. Switching models usually means swapping SDKs, rewriting the call and keeping track of separate prepaid balances or monthly minimums. Small side projects get hit hardest, because you end up topping up several accounts that each sit mostly unused. And comparing cost is messy when every provider shows prices on a different page in a different way. Some teams build their own routing layer to hide all this, but then they own that code forever, and it has to be patched each time a provider changes its API or adds a model.
This part describes the usual way. It makes no claims about Somnus, so nothing is quoted here.
02
How Somnus does it
Somnus gives you a single key that works against an OpenAI-compatible endpoint, so the official openai package in Python or Node.js can reach models from Anthropic, OpenAI, Google, xAI, DeepSeek and others. You keep one prepaid balance instead of one per provider, and you pay per token at each model's list price. Every top-up is credited at 2x or more, which works out to about half the official rate. The credit does not expire, so a balance you load for a weekend project is still there next month. If a model you rely on gets slower or pricier, you switch the name in your config and keep the same key, balance and code.
We built an OpenAI-compatible gateway so a single Somnus key could reach Claude, GPT, Gemini, Grok, DeepSeek and dozens moreQuoted from somnus.world
Copy-paste guides for calling 50+ models through one OpenAI-compatible endpoint in your language.Quoted from somnus.world
Rates are per 1M tokens and match each model's list price. Every top-up is credited at 2× or more, so each dollar you pay buys at least two dollars of usage.Quoted from somnus.world
03
Step by step
- 1Sign up and claim the free starting credit after card verification.
- 2Create your Somnus key and put it in your environment file.
- 3Point the openai client at the Somnus endpoint using the guide for your language.
- 4Set the model name in the request to the model you want to try.
- 5Change only that model name to compare answers from a different maker.
- 6Top up from $5 when the balance runs low, with no subscription.
04
Tips
Start with the guide for the language you already use. There are walkthroughs for Python, JavaScript, TypeScript, Next.js, Go, PHP, Ruby and plain curl, each covering a basic request, streaming and JSON output.
How to call 50+ AI models from Python with the official openai Python package: setup, a basic request, streaming, and JSON output through one OpenAI-compatible endpoint.Quoted from somnus.world
Use a cheap model for routine calls and save the large ones for hard requests. The price table lists every model per million tokens, so you can see the gap before you pick.
Rates are per 1M tokens and match each model's list price.Quoted from somnus.world
Reuse cached prompts where your code allows it. Cached input is charged at the model's lower cache rate, which matters for agents that resend long context.
Cached input is billed at the model's lower cache rates.Quoted from somnus.world
Keep the model name in a config value rather than hard coding it. Then a model comparison is a one line change and you can roll back fast if a new model behaves worse on your prompts. Write down a small set of test prompts from your real app and run them against each model you consider, so the choice rests on your own data rather than on a leaderboard.
General advice. Not a claim about the product.
05
Questions
Is there a monthly subscription for the API?
No. Pay as you go is prepaid credit with no subscription and no monthly caps or throttling.
Pay as you go has no subscription: simple prepaid credit, no monthly caps or throttling.Quoted from somnus.world
Does unused credit expire?
No. Credit never expires, so you can top up once and use it whenever you like.
Credit never expires, so you can top up once and use it whenever you like.Quoted from somnus.world
Is there an option for a team that shares one budget?
Yes. The Dreamcaster plan for teams and heavy users is arranged directly and includes shared team budgets and invoicing.
Custom volume pricing, shared team budgets, priority support and invoicing.Quoted from somnus.world