openrouter

package
v0.2.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL