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

# OpenRouter

> Access hundreds of LLMs through one OpenAI-compatible API with per-generation cost tracking via OpenRouter

## At a glance

* **Availability**: Experimental ([how to enable](/cloud/integrations)).
* **Auth**: API key.
* **Connection**: The key comes from `OPENROUTER_API_KEY`.
* **Docs**: [https://openrouter.ai/docs/api/reference/overview](https://openrouter.ai/docs/api/reference/overview)

## Credentials

Set these per environment. See [Connect an integration](/cloud/integrations).

| Variable             | Required | Description                                                                          |
| -------------------- | -------- | ------------------------------------------------------------------------------------ |
| `OPENROUTER_API_KEY` | Yes      | OpenRouter API key (starts with sk-or-) [Docs](https://openrouter.ai/settings/keys). |

## Setup

1. **Create an OpenRouter account**: Go to [https://openrouter.ai](https://openrouter.ai) and sign up or sign in. Some models offer free variants for testing; paid models require purchasing credits under Settings → Credits.
2. **Create an API key**: Open [https://openrouter.ai/settings/keys](https://openrouter.ai/settings/keys), click 'Create Key', and optionally set a credit limit for the key.
3. **Store the key**: Copy the key and add it to your .env file as OPENROUTER\_API\_KEY=sk-or-...
4. **Verify access**: Run the List Models tool to confirm the key works, then try a chat completion with a model like openai/gpt-4o-mini.

* Model IDs are namespaced as vendor/model, e.g. anthropic/claude-sonnet-4
* Chat completions consume prepaid credits; use the Get Generation tool to inspect the exact cost of a request
* The Get Credits endpoint requires a management key per OpenRouter's docs - a regular inference key may be rejected there

Provider API reference: [https://openrouter.ai/docs/api/reference/overview](https://openrouter.ai/docs/api/reference/overview)

## Tools

| Tool                   | Access | Description                                                                                                                                                                  |
| ---------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| List Models            | Read   | List the models available through OpenRouter                                                                                                                                 |
| Create Chat Completion | Write  | Generate a chat completion from any OpenRouter model                                                                                                                         |
| Get Generation         | Read   | Get metadata, token counts, and cost for a past generation by ID                                                                                                             |
| Get Current Key        | Read   | Get the current API key's label, credit usage (total/daily/weekly/monthly in USD), spend limit, remaining limit, and free-tier status - works with the regular inference key |
| Get Credits            | Read   | Get total credits purchased and used for the account (OpenRouter requires a management key for this endpoint)                                                                |

## Example prompts

* List the models available through OpenRouter and highlight a few with large context windows.
* Use OpenRouter to send the same prompt to two different models and compare the responses.
