OpenAI-Compatible API Endpoint: How to Switch Between Any AI Model Using One API Key
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.
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.
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.
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.
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.
Code Example: Universal Model Switching in 2 Lines of Code #
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 #
Q: Does an OpenAI-compatible endpoint support streaming?
Yes, standard Server-Sent Events (SSE) streaming works identically across all underlying models.
Q: 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.
Q: 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.
Build with API100
Access 100+ AI models through one lightning-fast OpenAI-compatible API with sub-50ms routing overhead and zero markup on cached tokens.

