openrouter-hello-world
Installation
SKILL.md
OpenRouter Hello World
Overview
Send a minimal chat completion request through OpenRouter, understand the response format, try different models, and verify the full round-trip works. All requests go to the single endpoint POST https://openrouter.ai/api/v1/chat/completions.
Prerequisites
- An OpenRouter API key (
sk-or-v1-...) exported asOPENROUTER_API_KEY— see theopenrouter-install-authskill for setup curlandjqfor the command-line request, or Python 3.8+ / Node.js 18+ with the OpenAI SDK (pip install openai/npm install openai)- A free-tier model works for every step here (no credits required for
:freemodels)
Instructions
- Export your key:
export OPENROUTER_API_KEY="sk-or-v1-...". - Send the minimal cURL request below and confirm you get a
choices[0].message.contentback. - Read the Response Format section to identify the four key fields (
id,model,usage,finish_reason). - Repeat the same request from your app language using the Python or TypeScript example.
- Swap model IDs per Try Different Models to confirm multi-model access works with the same code.
- Query
GET /api/v1/generation?id=gen-...per Check Generation Cost to verify cost tracking on the request you just sent.