Skip to content

ADR-0005: Built-in provider presets

Context

In v0.1 every OpenAI-compatible service went through one adapter, openai_compat. Users had to know each service's URL, key variable and quirks, and nothing service-specific was possible: OpenRouter could not report the cost it actually charged, and a stopped Ollama gave a generic "is the server running?" error.

Decision

  • Ship named presets as built-in adapters: openai, openrouter, groq, deepseek, gemini, mistral, together (hosted) and ollama (local).
  • All presets are rows in one table (agentplaykit/agents/providers.py) over the shared OpenAI-compatible code. A preset only fills in defaults (base_url, api_key_env); config can override any of them.
  • openai_compat stays as the generic adapter for every other OpenAI-compatible server. anthropic and mcp are unchanged.
  • Every preset keeps plain-text replies by default, so all models get the same prompt (ADP-003).
  • When a provider reports the cost it charged for a call (OpenRouter), that cost is used if the config sets no price. This is a measured value, not a guess, so ADR-0004's rule against built-in prices still holds.
  • A hosted preset is never treated as a free local endpoint, even through a proxy on localhost, unless config sets local: true; otherwise budget caps could silently stop applying.
  • OpenRouter attribution headers are sent only when config sets app_name or app_url.

Consequences

Most users get a one-line setup (use: openrouter, model: ...). The core still names no vendor: presets live in agents/ and are ordinary built-in adapters (ADP-001). Adding another OpenAI-compatible service is one row in the table plus a test. Services that are not OpenAI-compatible still ship as plugins (ADP-005).