agentc
GitHubagentc-sh/agentc
agentc
GitHubagentc-sh/agentc
›Introduction
Get started›Concepts in 5 minutes›Build your first agent›Add your first tool›Serve and connect
Concepts›Architecture overview›The manifest›The compilation pipeline›Archetypes›The graph›Tools and capabilities›Runtime libraries›Skills›Agents and prompts›Serving and protocols›Observability
Guides›Author a manifest›Write a tool›Give your agent a filesystem›Control network egress›Connect external tools via MCP›Connect agents via A2A›Use the bash tool›Control tool access with capabilities›Write templated prompts›Manage prompts with Langfuse›Pass context from the client›Configure a model provider›Connect a CopilotKit frontend›Deploy a standalone binary›Deploy with Docker and PostgreSQL›Instrument with OpenTelemetry›Extend code generation with blocks
Reference
Manifest
›build›locals›runtime›filesystem›network
providers
›Anthropic›OpenAI›Ollama›OpenRouter›xAI›Gemini›Hugging Face
›agent›graph›tool›skill›http_server
Runtime
›Observability

OpenRouter

Configuration for the OpenRouter model provider.

The openrouter sub-block configures the OpenRouter provider, which proxies hundreds of models from many providers through a single unified API. This is useful when you want to switch between models from different providers without managing multiple API keys or changing your agent configuration.

Unlike the openai provider, OpenRouter does not have a fixed model catalogue. The models list accepts any model identifier that OpenRouter supports, in the form provider/model-name, such as openai/gpt-4o or anthropic/claude-3.5-sonnet.

Fields

FieldTypeRequiredruntime()Description
modelslistnonoAllowlist of models for this provider. Each entry is a plain string or a config object with name and params. When omitted, no allowlist is enforced.
configblocknoConnection configuration.
config.api_keystringnoyesOpenRouter API key. Wrap in secret(runtime(...)) to keep it out of build artifacts.
paramsblocknoProvider-level inference parameter defaults. Applied to every request unless overridden at the model level.

The config block is optional. When omitted, the client reads credentials from the OPENROUTER_API_KEY environment variable.

params

The params block sets inference parameter defaults for all models under this provider. All fields are optional and support runtime().

FieldTyperuntime()Description
max_tokensintegeryesMaximum number of tokens to generate.
temperaturefloatyesSampling temperature.
top_pfloatyesNucleus sampling probability.
stop_sequenceslist of stringsyesSequences that stop generation.
frequency_penaltyfloatyesPenalty for token frequency.
presence_penaltyfloatyesPenalty for token presence.
seedintegeryesSeed for deterministic sampling.
provider_paramsobjectyesProvider-specific parameters passed directly to the API.
note

top_k is not part of the OpenAI-compatible wire format that OpenRouter uses. Setting it has no effect and it will be ignored.

Example

agent.acl
providers {
  openrouter {
    models = [
      "openai/gpt-4o-mini",
      {
        name = "anthropic/claude-3.5-sonnet"
        params {
          max_tokens  = 8192
          temperature = 0.7
        }
      }
    ]

    config {
      api_key = secret(runtime("OPENROUTER_API_KEY"))
    }

    params {
      max_tokens  = 2048
      temperature = 0.5
    }
  }
}

agent "assistant" {
  graph {
    type = "react"
  }

  model {
    provider = "openrouter"
    name     = "openai/gpt-4o-mini"
  }
}
tip

Always wrap API keys in secret(runtime(...)). This prevents the key from appearing in build artifacts and the output of agentc inspect.

← PreviousOllamaNext →xAI

© 2026 pogue.dev. All rights reserved.

Creative CommonsCC BY 4.0
On this pageFieldsparamsExample

Search docs

Search the agentc documentation