Nexus

OpenRouter

Access hundreds of models through OpenRouter's unified API with Nexus.

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

Installation

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

Quick Start

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

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

Options

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

Capabilities

CapabilitySupported
ChatYes
StreamingYes
EmbeddingsYes
VisionYes
ToolsYes
ThinkingNo

Models

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

On this page