Skip to main content

Crate daimon_provider_openrouter

Crate daimon_provider_openrouter 

Source
Expand description

OpenRouter model provider for the Daimon agent framework.

This crate provides an implementation of the Model trait that connects to the OpenRouter Chat Completions API — an OpenAI-compatible gateway that routes to hundreds of models (OpenAI, Anthropic, Google, Meta, and more) behind a single API key. Model ids use OpenRouter’s vendor/model form, e.g. openai/gpt-4o or anthropic/claude-sonnet-4.

It supports configurable timeouts, retries with exponential backoff, response format constraints, parallel tool calls, and the optional HTTP-Referer / X-Title attribution headers OpenRouter uses for its public rankings.

§Example

ⓘ
use daimon_provider_openrouter::OpenRouter;
use daimon_core::Model;

// Reads OPENROUTER_API_KEY from the environment.
let model = OpenRouter::new("openai/gpt-4o")
    .with_app_name("my-app");

Structs§

OpenRouter
OpenRouter model provider for the Chat Completions API.

Constants§

DEFAULT_MAX_RETRIES