> ## Documentation index
> Fetch the complete documentation index at: https://haarness.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Models and routers

With a Cloud account you can use every model in the [model catalogue](https://haarness.ai/models) without signing up with each
provider. Model requests are paid from your AI credits. If you already pay a provider, a router can use your own
key instead.

## Use Cloud models in Desktop and the CLI

1. Sign in: run `haarness login`, or choose **Sign in to Haarness** in Desktop.
2. In the model picker, choose **Haarness Cloud** and pick a model.

That is all. You do not need provider keys or an API key on your computer. Requests are paid from your plan's
monthly AI credits. If you turn on **Overage** in **Billing**, purchased credits take over when those run out.

## Call models from your own code

The router speaks the OpenAI API, so any OpenAI-compatible client works.

1. Open **API keys** and choose **Create API key**.
2. Pick the **Models only** preset. If you want, set a **Monthly spending cap (credits)** or choose **Only selected
   models** under **Model access**.
3. Copy the key; it is shown only once. Store it in your secret manager as `HAARNESS_API_KEY`.

```python
import os
from openai import OpenAI

client = OpenAI(base_url="https://router.haarness.ai/v1", api_key=os.environ["HAARNESS_API_KEY"])
reply = client.chat.completions.create(
    model="openai/gpt-6-luna",
    messages=[{"role": "user", "content": "Say hello"}],
)
print(reply.choices[0].message.content)
```

Model names look like `provider/model`. The [model catalogue](https://haarness.ai/models) lists every model with its price.

## Routers: choose who pays for models

A router decides which models your account can use and how they are paid for. Every account has a **Default
router** that pays with **Cloud credits**. Create more in **Routers → Create router**:

| Model billing | Who pays | Use it when |
| --- | --- | --- |
| **Cloud credits** | Your Cloud balance | You want every model with no provider accounts |
| **Your provider keys** | Your provider bills you directly | You already have provider accounts or contracts |

With **Your provider keys**, choose **Provider keys** on the router, pick the provider and choose **Save key**. Only
providers with a key are available, and the router never falls back to Cloud credits. Provider keys are encrypted
and never shown again. A router with your own keys still needs an active plan or trial on the account.

**Limit available models**, under **Configure**, restricts a router to the models you list, which is useful for a
team or an app that should only use approved models.

### Use a specific router

- **In your code:** each router has its own endpoint on the **Routers** page. Use it as the base URL instead of
  `https://router.haarness.ai/v1`. The standard endpoint always uses your default router.
- **In Desktop:** open the account menu and pick the **Model router**. It appears when your account has more
  than one router.
- **In the CLI:** list your routers with `haarness account --routers`, then choose one with
  `haarness account --router ROUTER_ID`.

## Keep spending under control

- **Per key:** an API key can have a **Monthly spending cap (credits)**, a **Maximum credits per request**,
  **Requests per minute** and **Concurrent requests**.
- **For the whole account:** turn **Overage** off in **Billing**. When your monthly AI credits run out, model
  requests stop instead of using purchased credits.

See [What a model request costs](https://haarness.ai/docs/cloud/model-costs.md) for worked examples.

## Run the router yourself

To run the model router on your own infrastructure with your own provider accounts, see [Run the router
yourself](https://haarness.ai/docs/cloud/self-hosted-router.md).
