# Quickstart

Call any model on llm.buzz with the OpenAI or Anthropic SDK you already use.

If you use OpenRouter today, [Coming from OpenRouter](from-openrouter.md) lists what differs.

## Get a key

Create a key in the console under [Keys](https://app.llm.buzz/console/keys), and keep it in an environment variable.

```bash
export LLM_BUZZ_KEY="exp_vk_..."
```

## Make a request

Point your SDK at `https://api.llm.buzz/api/v1`. The Anthropic SDK works too, through `/api/v1/messages`.

```python tab="Python"
from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.llm.buzz/api/v1",
    api_key=os.environ["LLM_BUZZ_KEY"],
)
reply = client.chat.completions.create(
    model="deepseek/deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)
```

```ts tab="TypeScript"
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.llm.buzz/api/v1",
  apiKey: process.env.LLM_BUZZ_KEY,
});
const reply = await client.chat.completions.create({
  model: "deepseek/deepseek-v4.1-flash",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(reply.choices[0].message.content);
```

```bash tab="curl"
curl https://api.llm.buzz/api/v1/chat/completions \
  -H "Authorization: Bearer $LLM_BUZZ_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek/deepseek-v4.1-flash", "messages": [{"role": "user", "content": "Hello"}]}'
```

## Stream the answer

Set `stream` to true to get the answer as it is generated. [Streaming](streaming.md) covers the events of each text API and what a failure looks like.

```python
stream = client.chat.completions.create(
    model="deepseek/deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Write a haiku"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")
```

## Choose a model

Model names are `author/slug`, as on each model page. By default each request goes to the best provider on price and speed, and fails over to the next one. [Choosing an API](choosing-an-api.md) says which API each kind of model takes.

```python
# the cheapest provider first
model="deepseek/deepseek-v4.1-flash:floor"

# only providers that keep nothing
extra_body={"provider": {"zdr": True}}
```

## Handle errors

The error body's `metadata.gateway_code` says what went wrong; [Errors](errors.md) lists the codes.

| Status | Code | What to do |
|---|---|---|
| 401 | `invalid_key` | Check the key, and that it is not disabled or revoked. |
| 402 | `insufficient_credits` | Add credit, or turn on auto top-up. Free models still answer. |
| 404 | `model_not_found` | Check the model name on the [Models page](/models). |
| 404 | `no_allowed_providers` | Your provider preferences leave no provider. Relax them. |
| 429 | `unavailable_route` | Wait for `Retry-After` seconds, then retry. |
| 503 | `unavailable_route` | No provider could answer just now. Retry with backoff. |
