Native Mode
Use any provider’s SDK as-is, pointed at your gateway
Use any provider’s SDK as-is, pointed at your gateway
Native mode is the simplest way to integrate with Gateway AI. You keep using your existing provider SDK — OpenAI, Anthropic, or Google — and just change the base URL and API key. Everything else stays the same.
Your SDK sends requests to Gateway AI instead of directly to the provider. The gateway:
Because the request is forwarded verbatim, every feature of the provider’s API works: streaming, function calling, tool use, vision, JSON mode, and anything new they add.
Pass your Gateway AI proxy key where the SDK expects the provider’s API key:
api_key="sk-proxy-..." (sent as Authorization: Bearer)api_key="sk-proxy-..." (sent as x-api-key)api_key="sk-proxy-..." (sent as x-goog-api-key)The gateway accepts your proxy key from any of these headers: Authorization: Bearer, x-api-key, or x-goog-api-key. It strips the key, validates it, and replaces it with the real provider API key before forwarding.
Exactly two things:
sk-proxy-... proxy keyNote that OpenAI’s SDK includes /v1 in its default base URL (https://api.openai.com/v1), so your gateway base URL must also include /v1 (e.g., https://api.trygateway.ai/openai/v1). Anthropic and Gemini SDKs append their API version paths automatically, so their base URLs do not need /v1.
Nothing else changes. Your prompts, parameters, streaming logic, error handling, and response parsing all stay the same.