# OpenRouter — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API |
> |---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Unified LLM gateway — one OpenAI-compatible API routing to hundreds of models from Anthropic, OpenAI, Google, Meta, and more.

**Category:** AI / LLM | **Website:** [openrouter.ai](https://openrouter.ai) | **Docs:** [openrouter.ai/docs](https://openrouter.ai/docs)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/openrouter/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

> Also available via public x402 on Base (no account needed): [x402/openrouter.md](https://beta.paywithlocus.com/x402/openrouter.md)

## Endpoints

### Chat Completions

Generate text with any OpenRouter-listed model. OpenAI-compatible request/response format with provider-prefixed model ids.

**Estimated cost:** Model-dependent (~$0.001–$0.50)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | Yes | Provider-prefixed model ID (e.g. 'anthropic/claude-sonnet-5', 'anthropic/claude-haiku-4.5', 'openai/gpt-oss-120b', 'google/gemini-2.5-flash') |
| `messages` | array | Yes | Conversation messages. Each: { role: "system"\|"user"\|"assistant", content: "text" } or multimodal content arrays per the OpenAI format. |
| `max_tokens` | number | No | Maximum output tokens. Required for public x402 so the authorization has a hard ceiling. |
| `temperature` | number | No | Sampling temperature (0.0–2.0, default 1.0) |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/openrouter/chat \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<string>","messages":"<array>","max_tokens":"<number>","temperature":"<number>"}'
```
