Skip to main content
Access 160+ AI models at up to 50% off by routing the OpenAI Python or Node.js SDK through Flatkey. Switching requires one line of code: set base_url to https://router.flatkey.ai/v1 and use your Flatkey API key. Every other SDK feature — streaming, function calling, async clients, retry logic — works exactly as before.

Installation

Basic setup

Chat completions

Streaming

Function calling / tool use

python

Using non-OpenAI models

You can call any Flatkey-supported model using the same client — just change the model parameter:
python

Async client

python
Any model ID in the Model Directory works with the OpenAI SDK through Flatkey — including Claude, Gemini, DeepSeek, and Qwen models.