KeyoAPI

← Blog

How to use an OpenAI-compatible API in Python

Point the official OpenAI Python SDK at KeyoAPI — same client, different base_url and key.

1. Install

pip install openai

2. Create a client

After sign-up, mint an API key and set:

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_KEYO_API_KEY",
    base_url="https://www.keyoapi.xyz/v1",
)

resp = client.chat.completions.create(
    model="deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Hello from KeyoAPI"}],
)
print(resp.choices[0].message.content)

3. Pick a model ID

Use exact catalog IDs from the static list /pricing-list or interactive /pricing. Free $0 IDs (fair-use) are on /free-models.

4. Common mistakes

More setup notes: Docs. Also see Node.js and Cursor.

← Blog · Home