OpenAI SDK Compatibility
Switch the base URL, API key, and model ID to use the official OpenAI SDK with GonkaGate.
Change only the base URL, API key, and model ID to use the official OpenAI SDK with GonkaGate. Keep the same client shape, messages, and most of the same app logic for POST /v1/chat/completions and GET /v1/models.
Minimum working change
Change the three connection values GonkaGate owns: base URL, API key, and model ID.
client = OpenAI(
- base_url / baseURL = "https://api.openai.com/v1",
+ base_url / baseURL = "https://api.gonkagate.com/v1",
- api_key = "sk-..."
+ api_key = "gp-..."
)
response = client.chat.completions.create(
- model = "gpt-..."
+ model = "<current-gonkagate-model-id>"
)Expected result: your existing chat.completions.create(...) call still works after you swap the connection values and use a current GonkaGate model ID.
If your app enforces strict response typing, allow additive usage fields such as base_cost_usd, platform_fee_usd, and total_cost_usd.
What you need before you run it
- A verified GonkaGate account
- A saved
gp-...API key in your server-side secret store - A current GonkaGate model ID instead of an OpenAI default model name
- Enough prepaid USD balance for the request
Use Authentication and API Keys for key creation, storage, and rotation.
Common errors and current limits
401 invalid_api_keyusually means the Bearer value, key state, or account state is wrong.404 model_not_foundmeans the model ID is stale or not supported on GonkaGate.429 insufficient_quotameans the available prepaid USD balance is too low for the request.429 rate_limit_exceededand5xxshould be handled as runtime failures with bounded retries.- This path covers the official OpenAI SDK for
chat.completionsplusGET /v1/models. - If your app depends on embeddings, Responses API, Assistants, Audio, Batch, or fine-tuning, keep those flows on a different provider path for now.
- Streaming, tools, JSON mode, and vision depend on the selected model and the API surface you use.
See also
- SDK Guides for GonkaGate to choose the runtime-specific guide for Python, TypeScript, Go, .NET, or Java.
- Model Selection Guide to choose and refresh GonkaGate model IDs.
- OpenAI to GonkaGate Migration Guide if you already have working OpenAI code and need rollout-oriented switch steps.
- Framework & Tool Guides if you use LangChain, Vercel AI SDK, or another wrapper instead of the raw OpenAI client.
- API Reference Overview for exact request fields, streaming behavior, and runtime-independent failure policy.
Was this page helpful?