Architecture

Inference providers

Providers are native extensions that implement InferenceEngine. The runtime selects an engine by provider id, sends it a canonical Roder turn, and receives canonical inference events back.

Default provider set

  • roder-ext-openai-responses - OpenAI Responses-style inference.
  • roder-ext-openai-chat-completions - chat-completions-compatible endpoints.
  • roder-ext-anthropic - Anthropic Messages-style inference.
  • roder-ext-gemini - Gemini through the configured Google-compatible path.
  • roder-ext-cursor - Cursor Composer and proxied frontier models through Cursor AgentService.
  • roder-ext-openrouter - OpenRouter API-key provider, including the Grok Build catalog entry.
  • roder-core::fake_provider - deterministic mock behavior for tests and offline work.
  • roder-codex-auth and host wiring - Codex OAuth where enabled.

Cursor AgentService

Cursor is now a native provider id. Roder exchanges a Cursor User API Key, calls the HTTP/2 AgentService path directly, streams text and thinking metadata, and maps Cursor-native read, edit, shell, grep, and glob requests into canonical Roder tools. Agentic Cursor turns still execute through Roder policy and tool routing rather than bypassing the runtime.

export CURSOR_API_KEY="..."
RODER_PROVIDER=cursor RODER_MODEL=cursor/composer-2.5 cargo run -p roder-cli

OpenRouter and Grok Build

OpenRouter is a first-class provider id. The built-in catalog includes x-ai/grok-build-0.1, a 256k-context Grok Build route that supports tools, structured outputs, image input, compaction, and patch-style edits. Roder keeps the OpenRouter model slug intact, so clients should keep provider and model fields separate instead of splitting every model id on /. Its reasoning options are none, low, medium, and high.

export OPENROUTER_API_KEY="..."
RODER_PROVIDER=openrouter RODER_MODEL=x-ai/grok-build-0.1 cargo run -p roder-cli

See OpenRouter setup for environment variables, optional attribution headers, model discovery, and app-server configuration behavior.

Selecting defaults

# ~/.roder/config.toml
provider = "openai"
model = "gpt-5.5"
reasoning = "medium"
RODER_PROVIDER=anthropic RODER_MODEL=claude-opus-4-5 cargo run -p roder-cli
RODER_PROVIDER=mock cargo run -p roder-cli

Provider contract

  • Advertise metadata, auth type, capabilities, and model descriptors.
  • Stream text, tool calls, errors, and completion as canonical InferenceEvent values.
  • Preserve tool-call ids across the turn so the runtime can route results back correctly.
  • Handle cancellation promptly when the active turn is interrupted.
Provider-specific APIs stay outside the core. Responses, Messages, Gemini, Cursor AgentService, OpenRouter, and chat-completions shapes are adapter details, not runtime types.