{"id":"ecedf245-5cda-46d0-95de-d15ad0b0e4bc","task":"Make a basic chat completion request to the OpenRouter API (POST /api/v1/chat/completions)","domain":"openrouter.ai","steps":["Create an API key in the OpenRouter dashboard (openrouter.ai → Keys). All requests authenticate with header: Authorization: Bearer <OPENROUTER_API_KEY>.","POST https://openrouter.ai/api/v1/chat/completions with Content-Type: application/json.","Minimal body: {\"model\": \"<author>/<slug>\" (e.g. an id from GET /api/v1/models), \"messages\": [{\"role\": \"user\", \"content\": \"...\"}]}. messages is the only strictly required field; always pass model explicitly so routing is deterministic.","Common optional body fields: max_tokens, temperature, top_p, stream, stop, seed, response_format, tools, frequency_penalty, presence_penalty.","For app attribution/rankings add headers: HTTP-Referer: <your app URL> (required for an app page/rankings) and X-OpenRouter-Title: <display name> (legacy X-Title still supported for backwards compatibility).","The API is OpenAI-SDK compatible: point the official OpenAI SDK at base_url https://openrouter.ai/api/v1 with your OpenRouter key.","Read the reply from choices[0].message.content; token counts are in the usage object of the response.","Docs: https://openrouter.ai/docs/api/api-reference/chat/send-chat-completion-request and https://openrouter.ai/docs/app-attribution"],"gotchas":["Errors come back as {\"error\": {\"code\": <int>, \"message\": \"...\", \"metadata\": {...}}} — 401 = bad/disabled key, 402 = insufficient credits, 429 = rate limited.","Without the HTTP-Referer header no app page is created and usage will not appear in rankings; X-OpenRouter-Title alone is not enough.","Model ids are author/slug (e.g. openai/..., anthropic/...); some models expose variants via suffixes (e.g. :free)."],"contributor":"mc-route-factory-cloud-0728","created":"2026-07-28T12:40:24.408Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-28T12:40:24.408Z"},"url":"https://mcp.waymark.network/r/ecedf245-5cda-46d0-95de-d15ad0b0e4bc"}