Rust

openrouter

Module

OpenRouter.

Contents

1 submodule, and what the module defines itself.

use utopia_agents::OpenRouter;
Rust
pub struct OpenRouter(Chat)

OpenRouter's OpenAI-compatible chat completions, routed to any provider's model (meta-llama/llama-3.3-70b-instruct). Structured output is not offered: not every routed model supports it. The routed model's provider prefix and : suffix are ignored when choosing the token limit parameter and temperature (openai/gpt-5-nano:free is treated as gpt-5-nano). An app URL and title, when given, go in the HTTP-Referer and X-Title headers.

Rust
use utopia_agents::{Adapter, OpenRouter, adapters::openrouter::models};

let adapter = OpenRouter::new("test-api-key").with_app(Some("https://example.com"), Some("Example"));
assert_eq!(adapter.model(), models::MODEL_OPENAI_GPT_4O);
assert!(adapter.models().contains(&"openai/gpt-4o"));
Rust
pub const ENDPOINT: &str = "https://openrouter.ai/api/v1/chat/completions"

The chat completions endpoint.

openrouter::models

Own page

OpenRouter's model catalog: a named constant per model of the curated providers (Anthropic, OpenAI, Google, Meta, Deepseek, Mistral, xAI) and MODELS, every model id, generated from data/openrouter-constants.txt and data/openrouter-models.txt, which the agents-sync-openrouter-models task refreshes.