# OpenAI Chat Completions with Keln
Call open models from your app using the OpenAI SDK or any OpenAI-compatible client. Just change
the base URL and API key, then choose a Keln model id.
If you're switching from OpenAI or OpenRouter, see the [migration guide](migrate.md) for differences
in parameters and response fields.
## What you need to start
- A Keln API key. Sign up at [app.keln.ai](https://app.keln.ai), then open **Keys** →
**Create key**.
- Credit on your Keln account. **Billing** → **Add credit**.
- For Python or TypeScript, the OpenAI SDK (`pip install openai` or `npm install openai`).
## Make a request
Paste one of these into your project, with your key in place of `sk-keln-…`.
=== "Python (openai)"
```python
from openai import OpenAI
client = OpenAI(base_url="https://api.keln.ai/v1", api_key="sk-keln-…")
stream = client.chat.completions.create(
model="deepseek-ai/deepseek-v4-flash",
messages=[{"role": "user", "content": "Hello Keln"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
```
=== "TypeScript (openai)"
```typescript
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.keln.ai/v1", apiKey: "sk-keln-…" });
const stream = await client.chat.completions.create({
model: "deepseek-ai/deepseek-v4-flash",
messages: [{ role: "user", content: "Hello Keln" }],
stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
```
=== "curl"
```bash
curl https://api.keln.ai/v1/chat/completions \
-H "Authorization: Bearer sk-keln-…" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-ai/deepseek-v4-flash",
"messages": [{"role": "user", "content": "Hello Keln"}],
"stream": true
}'
```
## Choosing a model
Use a Keln model id from [Models & pricing](models-pricing.md).
## API reference
The [Chat completions](api/chat-completions.md) page lists every parameter and how it behaves.
OpenAI Chat Completions with Keln
Call open models from your app using the OpenAI SDK or any OpenAI-compatible client. Just change
the base URL and API key, then choose a Keln model id.
If you're switching from OpenAI or OpenRouter, see the migration guide for differences
in parameters and response fields.
What you need to start
A Keln API key. Sign up at app.keln.ai, then open Keys →
Create key.
Credit on your Keln account. Billing → Add credit.
For Python or TypeScript, the OpenAI SDK (pip install openai or npm install openai).
Make a request
Paste one of these into your project, with your key in place of sk-keln-….