--- name: openrouter description: Use any model through one key with OpenRouter, for text, images and video (Veo, Kling, Seedance, Wan, GPT Image and hundreds of chat models). Use when the user names a model from any company, wants video, or wants to compare models. Needs OPENROUTER_API_KEY. --- # OpenRouter Key: `OPENROUTER_API_KEY`. Get one at https://openrouter.ai/settings/keys Examples pipe JSON through `jq`. Without it, read the JSON and take the field named in each step. Every call uses `-H "Authorization: Bearer $OPENROUTER_API_KEY"`. Model ids look like `company/model`. ## Text ```bash curl -s https://openrouter.ai/api/v1/chat/completions \ -H "Authorization: Bearer $OPENROUTER_API_KEY" -H "Content-Type: application/json" \ -d '{"model":"anthropic/claude-opus-5.5","messages":[{"role":"user","content":"Five names for a hot sauce."}]}' \ | jq -r '.choices[0].message.content' ``` ## Image ```bash curl -s https://openrouter.ai/api/v1/images \ -H "Authorization: Bearer $OPENROUTER_API_KEY" -H "Content-Type: application/json" \ -d '{"model":"openai/gpt-image-2.5-sunburst","prompt":"A ceramic mug shaped like a cactus, product photo","n":1}' \ | jq -r '.data[0].b64_json' | base64 --decode > image.png ``` ## Video (a job you poll) ```bash # 1. start it: returns {"id": "...", "status": "pending", "polling_url": "..."} curl -s https://openrouter.ai/api/v1/videos \ -H "Authorization: Bearer $OPENROUTER_API_KEY" -H "Content-Type: application/json" \ -d '{"model":"google/veo-3.1-fast","prompt":"Slow dolly shot through a neon ramen bar at night","duration":8,"aspect_ratio":"16:9"}' # 2. poll every 10 seconds until "status" is "completed" (or "failed") curl -s https://openrouter.ai/api/v1/videos/$ID -H "Authorization: Bearer $OPENROUTER_API_KEY" # 3. download the clip (the URL is in unsigned_urls[0] and needs the key) curl -s -L "$URL" -H "Authorization: Bearer $OPENROUTER_API_KEY" -o clip.mp4 ``` ## Find models and prices - Chat: `https://openrouter.ai/api/v1/models` - Images: `https://openrouter.ai/api/v1/images/models` - Video: `https://openrouter.ai/api/v1/videos/models` (price per second, durations, aspect ratios) Video is billed per second, so check the price before a long clip.