DEV Community

DoRoeMon
DoRoeMon

Posted on

One API Key, Every Model: Calling GPT-6, Claude, Gemini, and DeepSeek Through a Single Endpoint

If you build AI-powered apps, you probably juggle API keys from multiple providers: one for GPT-6, one for Claude, one for Gemini, one for DeepSeek. Each has its own SDK, its own auth flow, its own billing dashboard — and its own rate limits to monitor.

The good news: almost every major model today can be reached through the same [OI]-compatible chat completions interface. That means one client, one key format, and one base URL can cover your whole stack.

The pattern: swap base_url, keep everything else

The official openai SDKs let you point at any compatible endpoint:

Python

from openai import [OI]

client = [OI](
    api_key="sk-your-key",
    base_url="https://caapi.top/v1",   # <-- the only change
)

resp = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "hello"}],
)
print(resp.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

Node.js

import [OI] from "openai";

const client = new [OI]({
  apiKey: "sk-your-key",
  baseURL: "https://caapi.top/v1",
});

const resp = await client.chat.completions.create({
  model: "gpt-5.6-luna",
  messages: [{ role: "user", content: "hello" }],
});
Enter fullscreen mode Exit fullscreen mode

curl (quick connectivity check)

curl -s https://caapi.top/v1/chat/completions \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-astra","messages":[{"role":"user","content":"ping"}]}'
Enter fullscreen mode Exit fullscreen mode

Switching from GPT-6 Astra to Claude to DeepSeek becomes a one-word change to model — no new SDK, no new auth code.

Desktop clients work the same way

GUI clients like Cherry Studio, ChatBox, and NextChat all support custom [OI]-compatible endpoints. The setup is the same three fields every time:

Field Value
Base URL / API Host https://caapi.top/v1
API Key your sk- key
Model name whatever model you want

I keep a repo of copy-paste config templates for the popular clients here: ai-api-config-templates — it covers Cherry Studio, ChatBox, NextChat, plus runnable Python/Node examples and a curl test script. There's also a one-page quick start with the full model catalog and live pricing: caapi quick start.

Why an API gateway at all?

Beyond key consolidation, a gateway layer gives you:

  • One billing surface — usage and spend for every model in one dashboard, instead of four.
  • Drop-in model comparison — because every model is behind the same interface, A/B testing prompts across models is trivial.
  • Transparent, usage-based pricing — the example gateway above publishes live per-model pricing (input/output per 1M tokens, updated hourly) for its 40+ models, so there is no gap between the listed price and what you actually pay.

Quick troubleshooting guide

Symptom Usual cause
401 Unauthorized key typo or whitespace; check the Bearer prefix in raw HTTP
model not found model name typo — always copy the exact id from the provider's model catalog
404 Not Found base URL has a missing/extra /v1
Random slowness test with curl first to rule out the client

Full disclosure: the example gateway above, caapi.top, is a service I run. But the pattern itself — one [OI]-compatible endpoint in front of many models — is generic, and everything in this post works with any compatible gateway.

Top comments (0)