# magpie

magpie is a local gateway that points coding agents, such as Claude Code, Codex and OpenCode, at the provider and model you pick. kenari works in magpie as a provider. One link fills in the base URLs, and you paste your own API key.

## Add kenari with the import link

1. Install magpie from [usemagpie.ai](https://usemagpie.ai) and open it once.
2. Open the link [Add kenari to magpie](https://usemagpie.ai/import#name=kenari&chat=https%3A%2F%2Fkenari.id%2Fv1&responses=https%3A%2F%2Fkenari.id%2Fv1&anthropic=https%3A%2F%2Fkenari.id&website=https%3A%2F%2Fkenari.id&keys=https%3A%2F%2Fkenari.id%2Fkeys&icon=https%3A%2F%2Fkenari.id%2Fbrand%2Fmark.png). The page shows that requests go to kenari.id and that no API key is included. Press the button if magpie does not open by itself.
3. Paste a kenari API key from [API Keys](https://kenari.id/keys) and press **Add**.

magpie reads the model list from `https://kenari.id/v1/models`, so new kenari models show up without a new link.

## Add kenari from the terminal

Run this command to add the same provider from a terminal, with your own key in place of `kn-YOUR-KEY`:

```bash
magpie provider add kenari \
  url=https://kenari.id/v1 \
  responses=https://kenari.id/v1 \
  anthropic=https://kenari.id \
  key=kn-YOUR-KEY
```

## Base URLs

| API format | Base URL |
| --- | --- |
| OpenAI Chat Completions | `https://kenari.id/v1` |
| OpenAI Responses | `https://kenari.id/v1` |
| Anthropic Messages | `https://kenari.id` |

The Anthropic base URL has no `/v1`, because the client adds `/v1/messages` itself.

## Pitfalls

- Keep the Anthropic URL set. magpie then sends Claude models over Messages, which keeps prompt caching (Cache read is billed far below Input). Without it, Claude goes over Chat Completions and the cache markers your agent sets are dropped. See [Prompt caching](/en/docs/prompt-caching).
- A `401` means the key is not a kenari key. kenari keys start with `kn-`.
- Cost figures inside magpie do not come from kenari. Your real spend is on the [Usage](https://kenari.id/usage) page.

## See also

- [Integrations overview](/en/docs/integrations)
- [Claude Code](/en/docs/claude-code)
- [Codex](/en/docs/codex)
