# Claude Code Provider

Running models through the locally installed `claude` CLI on your Claude subscription.

`claude-code` (since v1.1.0) uses the locally installed and logged-in `claude` CLI as a model backend, so requests run on your Claude subscription instead of a pay-per-token API key. It is off by default and meant for personal setups: start Agenvoy with `agen --enable-claude-code` (the daemon must be stopped first with `agen stop`) to enable it for that TUI and the daemon it starts.

| Aspect | Behavior |
|---|---|
| Transport | One `claude -p` process per session and model, speaking `stream-json`. The CLI's own tools and MCP servers are disabled (`--tools ""`, `--strict-mcp-config`); tool calls are executed by Agenvoy under its usual rules |
| Tools | Only the tool names plus the full `find_tools` schema are sent; every other schema is fetched on demand through `find_tools` |
| Models | Listed from `models.agenvoy.com` (same catalog as `claude`), without sending any credential |
| Routing | Inside a tier, `claude-code` models rank ahead of every other provider, then `codex`; for the same base model under several providers, `claude-code` comes first. Since v1.1.1 a model named in the request, or the previous model kept for an unchanged subject, stays ahead of this reordering |
| Quota | Parsed from `claude -p /usage` — no API call — and shown with `Shift+U` and in `GET /v1/providers/quota` |
| Usage | Input tokens include cache writes, the same as for `claude` |
| Sessions | Since v1.1.1 each session + model keeps its own Claude Code session: the first turn starts `claude` with `--session-id`, later turns reuse the live process or, after it exits or the daemon restarts, `--resume` it; if resuming fails a fresh session is started with the full history. State lives in `sessions/<sid>/claude_code_<model>.json`. Calls without tools or without a session still run with `--no-session-persistence` |
| Prompt cache | Since v1.1.1 `CLAUDE_CODE_PROMPT_CACHE_TTL` is `5m` when the session's model or reasoning is `auto` (and for one-off calls), `1h` when both are pinned; a TTL change restarts the process |
| Tool call format | `<tool_call name="...">` blocks, and since v1.1.1 also `<invoke name="...">` with `<parameter name="...">` children (namespaced tags included); a reply that is only empty tags plus tool calls is shown as `Processing...` |
| When not enabled | The `/model add` row still appears, but registered `claude-code@` models are skipped by the agent registry, routing, the `/model` list and the dispatcher picker; `GET /v1/providers` marks the row `hidden` |
