OpenAI SDK
Drop-in usage of the official OpenAI SDK with the gateway as the baseURL.
Integrations
The official openai package — both TypeScript and Python — works without modification.
Set baseURL (or base_url) to the gateway, pass a gw_ key as the API key, and you're
done. Streaming, non-streaming, function calling, and embeddings (for models that support
them) all route through.
TypeScript
ts
For streaming:
Python
python
Function calling
Function calling round-trips end-to-end — the gateway translates OpenAI tool definitions
into the upstream's tool shape, then maps tool_use responses back into OpenAI's
tool_calls. The model must support tools (capabilities.tools = true on the catalog
page).
What works, what doesn't
| OpenAI feature | Status |
|---|---|
chat.completions.create (sync) | ✅ |
chat.completions.create (stream) | ✅ |
| Tool calls | ✅ when capabilities.tools = true |
Vision (image_url parts) | ✅ forwarded when the model supports vision; otherwise 400 model_does_not_support_images |
Structured output (response_format) | ❌ 400 response_format_not_supported |
| Embeddings | ➖ depends on operator config |
| Assistants API | ❌ not implemented |
| Realtime API | ❌ not implemented |
Gateway URL: https://api.toygate.store