Skip to main content

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.

Endpoint
 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_key usually means the Bearer value, key state, or account state is wrong.
  • 404 model_not_found means the model ID is stale or not supported on GonkaGate.
  • 429 insufficient_quota means the available prepaid USD balance is too low for the request.
  • 429 rate_limit_exceeded and 5xx should be handled as runtime failures with bounded retries.
  • This path covers the official OpenAI SDK for chat.completions plus GET /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

Was this page helpful?