Nexus
1.x
Docs/Nexus/OpenRouter
Open

Reading1 min
Updated31 Jul 2026
Sourcev1/providers/openrouter.mdx

OpenRouter is a meta-router that gives access to many models from different providers via a single API. Supports extra headers for site attribution.

Installation01

import "github.com/xraph/nexus/providers/openrouter"

Quick Start02

provider := openrouter.New(os.Getenv("OPENROUTER_API_KEY"))

gw := nexus.New(
    nexus.WithProvider(provider),
)

Options03

OptionDescription
openrouter.WithBaseURL(url)Override the API base URL (default: https://openrouter.ai/api/v1)
openrouter.WithSiteURL(url)Set the HTTP-Referer header for rankings
openrouter.WithSiteName(name)Set the X-Title header for rankings

Capabilities04

CapabilitySupported
ChatYes
StreamingYes
EmbeddingsYes
VisionYes
ToolsYes
ThinkingNo

Models05

ModelContextMax OutputInput PriceOutput Price
openai/gpt-4o128K16,384$2.50/M$10.00/M
anthropic/claude-3.5-sonnet200K8,192$3.00/M$15.00/M
meta-llama/llama-3.1-405b-instruct131K4,096$2.70/M$2.70/M
google/gemini-2.0-flash-0011M8,192$0.10/M$0.40/M