# Base URL and API key

> The two values every tool needs, where each tool takes them, and how to check them.

Connecting a tool to FreshRouter comes down to two values: the base URL and your API key. Both are the same for every model and every tool. The model is chosen later, in the tool itself.

## The base URL

```text title="Base URL"
https://freshrouter.com/v1
```

- Enter it as written. Nothing comes after `/v1`: no slash, no `/chat/completions`.
- It is the same for tools that speak OpenAI's format and tools that speak Anthropic's, such as Claude Code and Anthropic's SDK. Those add `/v1` of their own, and FreshRouter reads the doubled `/v1/v1` as one, so there is nothing to adjust.
- Some tools call the field API Host, Endpoint or API URL. It is the same thing.

## The API key

- Create it in **Console → API keys**. It starts with `sk-` and is shown in full only once.
- Paste it whole, with no spaces or quotes around it.
- One key works for every model. You can make a key for each tool, each with its own spending limit.

## Where each tool takes them

Claude Code, Codex, Pi and Grok Build have an installer that writes both for you. For the rest, and for setting things up by hand:

| Tool | Base URL goes in | API key goes in |
| --- | --- | --- |
| Claude Code | `ANTHROPIC_BASE_URL` | `ANTHROPIC_AUTH_TOKEN` |
| Codex | `base_url` in `~/.codex/config.toml` | `~/.codex/freshrouter-api-key` |
| Pi | `baseUrl` in `~/.pi/agent/models.json` | `apiKey` in the same file |
| Grok Build | `base_url` in `~/.grok/config.toml` | `api_key` in the same file |
| Cursor | Override OpenAI Base URL | OpenAI API Key |
| Cline, Roo Code, Kilo Code | Base URL | API Key |
| Chatbox | API Host | API Key |
| Open WebUI | URL | API Key |
| LibreChat | `baseURL` in `librechat.yaml` | `FRESHROUTER_API_KEY` in `.env` |
| n8n | Base URL | API Key |
| OpenAI and Anthropic SDKs | `base_url` in Python, `baseURL` in Node.js | `api_key` in Python, `apiKey` in Node.js |
| Any other tool | The field for a custom OpenAI or Anthropic address | The API key field |

Each tool on this list has its own page with the steps.

## Check that they work

This asks for the list of models. It costs nothing:

**macOS / Linux**

```bash
curl https://freshrouter.com/v1/models \
  -H "Authorization: Bearer sk-your-freshrouter-key"
```

**Windows**

```powershell
(Invoke-RestMethod -Uri "https://freshrouter.com/v1/models" `
  -Headers @{ Authorization = "Bearer sk-your-freshrouter-key" }).data.id
```

A list of models means the address and the key are both right. Anything else is explained under **If it doesn't work** on the **Quick start** page.
