Token EconomicsBeginner
OpenAI-Compatible API Endpoint: How to Switch Between Any AI Model Using One API Key
Direct Answer & Overview
A complete integration guide explaining how OpenAI-compatible unified endpoints allow developers to access Claude, Gemini, GPT-6, DeepSeek, and Llama using standard OpenAI SDKs by changing only base_url and model parameters.
1.Why the OpenAI REST Specification Became the Industry Standard
The OpenAI `/v1/chat/completions` schema—with its messages array (`system`, `user`, `assistant`, `tool`), temperature parameters, and streaming chunk format—has become the universal lingua franca of generative AI. Tooling like LangChain, Cursor, Continue, Vercel AI SDK, and DSPy all expect this schema natively.
2.The Two-Line Migration: Swapping base_url and API Key
Instead of installing proprietary vendor SDKs (`@google/genai`, `@anthropic-ai/sdk`, etc.), developers point their existing `openai` client to `https://api.apihundred.com/v1`. Now, changing `model: 'claude-sonnet-5'` or `model: 'gemini-3.8-flash'` works instantly without rewriting headers, payload structures, or response parsers.
3.One Wallet, Zero Subscription Sprawl
Unified gateways consolidate billing into a single prepaid or postpaid balance, eliminating the need to manage credit cards, invoice cycles, and rate-limit tiers across multiple cloud accounts.
Universal Model Switching in 2 Lines of Codetypescript
import OpenAI from "openai";
// One client instance for all models in the world
const client = new OpenAI({
baseURL: "https://api.apihundred.com/v1",
apiKey: process.env.API100_API_KEY,
});
async function askAI(model: string, query: string) {
const res = await client.chat.completions.create({
model, // 'gpt-6-astra' | 'claude-sonnet-5' | 'gemini-3.8-flash' | 'deepseek-r1'
messages: [{ role: "user", content: query }],
});
return res.choices[0].message.content;
}
// Seamless multi-provider execution
console.log(await askAI("claude-sonnet-5", "Refactor this function."));
console.log(await askAI("gemini-3.8-flash", "Summarize this article."));Frequently Asked Questions
Does an OpenAI-compatible endpoint support streaming?
Yes, standard Server-Sent Events (SSE) streaming works identically across all underlying models.
Does function calling work through an OpenAI-compatible gateway?
Yes, the gateway automatically translates tools and tool_calls objects into each provider's native format and normalizes responses.
Can I use Cursor and VS Code with an OpenAI-compatible endpoint?
Yes, simply enter https://api.apihundred.com/v1 into your IDE's OpenAI Base URL setting to unlock all models.
A100
API100 Engineering Team
Infrastructure & Latency Research

