Python SDK
Use the official OpenAI Python SDK with GonkaGate. No custom SDK required.
For API keys, base URL, and your first request, start with the Quickstart guide .
Installation
Install the official OpenAI Python SDK:
terminal
pip install openaiConfiguration
Configure the client to use GonkaGate's API endpoint:
config.py
from openai import OpenAI
client = OpenAI(
base_url="https://api.gonkagate.com/v1",
api_key="gp-your-api-key"
)Basic Usage
Make your first chat completion request:
basic_usage.py
from openai import OpenAI
client = OpenAI(
base_url="https://api.gonkagate.com/v1",
api_key="gp-your-api-key"
)
response = client.chat.completions.create(
model="qwen/qwen3-235b-a22b-instruct-2507-fp8",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, how are you?"}
],
temperature=0.7,
max_tokens=1000
)
print(response.choices[0].message.content)Async Usage
Use async/await for non-blocking requests:
async_usage.py
import asyncio
from openai import AsyncOpenAI
async def main():
client = AsyncOpenAI(
base_url="https://api.gonkagate.com/v1",
api_key="gp-your-api-key"
)
response = await client.chat.completions.create(
model="qwen/qwen3-235b-a22b-instruct-2507-fp8",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
asyncio.run(main())Language-specific notes
A few Python-specific tips before you ship:
- Use AsyncOpenAI for concurrent workloads.
- Set request timeouts to avoid hanging tasks.
- Keep API keys on the server (not in notebooks or front-end).
See Streaming and Error handling for real-time responses and retry guidance.