OpenAI SDK integration
Use Gonka24 with the OpenAI SDK
Call Gonka24 with the official OpenAI Python and TypeScript SDKs using a custom base URL and Chat Completions.
Configuration verified August 31, 2026
Connection details
Every example on this page uses the same Gonka24 OpenAI-compatible endpoint, a dashboard API key, and a live model ID.
- Base URL
- https://api.gonka24.com/v1
- Authentication
- Bearer sk-...
- Model
- GET /v1/models
Use a live model ID.
The catalog changes. Call GET /v1/models with your API key and copy an id from the response instead of relying on a model name in a guide.
bash
curl https://api.gonka24.com/v1/models \
-H "Authorization: Bearer $GONKA24_API_KEY"Ready-to-use config
Python
Install with pip install openai and export GONKA24_API_KEY before running the script.
python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.gonka24.com/v1",
api_key=os.environ["GONKA24_API_KEY"],
)
response = client.chat.completions.create(
model="<model-id-from-/v1/models>",
messages=[{"role": "user", "content": "Hello from Python"}],
)
print(response.choices[0].message.content)TypeScript
Install with npm install openai. Keep this server-side so the API key is not bundled into browser code.
typescript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.gonka24.com/v1",
apiKey: process.env.GONKA24_API_KEY,
});
const response = await client.chat.completions.create({
model: "<model-id-from-/v1/models>",
messages: [{ role: "user", content: "Hello from TypeScript" }],
});
console.log(response.choices[0]?.message.content);Set up OpenAI SDK
- Install the current official OpenAI SDK for Python or JavaScript/TypeScript.
- Export GONKA24_API_KEY in your server or shell environment.
- Fetch GET /v1/models and replace the model placeholder with an exact returned ID.
- Run the example and read choices[0].message.content from the Chat Completions response.
What is supported
Supported
Models and Chat Completions
Use client.models.list() for discovery and client.chat.completions.create() for generation.
Supported
Streaming
Set stream: true and consume the SDK's stream iterator for OpenAI-compatible SSE chunks.
Supported
Function tools
The Chat Completions tools and tool_choice fields are supported when the selected model route supports tool calls.
Not included
Other OpenAI APIs
Responses, Assistants, Files, Images, Audio, Embeddings, Fine-tuning, and Realtime are not part of this verified Gonka24 integration.
Verify before an agent task
- Fetch the model list and copy an exact model ID.
- Send a short plain chat request through OpenAI SDK.
- Confirm the request appears in your Gonka24 dashboard activity.
- Only then enable tool use, file writes, or long-running agent work.
Troubleshooting
The SDK calls api.openai.com: Use base_url in Python or baseURL in TypeScript. The property names are intentionally different.
404 on chat completions: The client base must be https://api.gonka24.com/v1; the SDK appends /chat/completions.
responses.create() fails: Use chat.completions.create(). Gonka24 does not expose the OpenAI Responses API in this verified contract.
401 or model error: Confirm the environment variable is set, then refresh GET /v1/models and copy a live ID exactly.
Verification sources
Checked against the product documentation below and the Gonka24 public API contract on August 31, 2026.
