Documentation
¶
Overview ¶
Package openrouter is the v1 ai://chat backend.
It speaks the OpenAI-compatible chat-completions API to OpenRouter's public endpoint (https://openrouter.ai/api/v1/chat/completions), which proxies to dozens of upstream model providers. One backend, many models — a deliberately conservative v1 choice (the spec's "boring foundation").
The backend self-registers in init() under the name "openrouter". The chassis activates it with a blank import in the main package.
**Leak posture.** The cleartext API key (OPENROUTER_KEY) is read from the secrets.SecretBag exactly once per Run, passed into the outbound http.Request's Authorization header, and never stored on the backend struct, never written to a trace field, never logged. A 401 response body is discarded immediately — providers occasionally quote a prefix of the submitted key in error messages, and that prefix would otherwise reach the response envelope and trace.