- Home
- Skills
- Dimitrigilbert
- Ai Skills
- Openrouter
openrouter_skill
- TypeScript
0
GitHub Stars
5
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill dimitrigilbert/ai-skills --skill openrouter- .env.example43 B
- .gitignore41 B
- package.json723 B
- QUICKSTART.md4.2 KB
- SKILL.md22.5 KB
Overview
This skill is an expert OpenRouter API assistant for AI agents, providing practical guidance for integrating with OpenRouter's unified access to 400+ models. It focuses on chat completions, streaming, tool calling, structured outputs, multimodal inputs, model selection, routing, and robust error handling. Use it to build reliable, cost-effective agent integrations that require provider flexibility and advanced features.
How this skill works
The skill describes the core request and response patterns for OpenRouter's chat/completions endpoint, including required headers and minimal request structure. It explains streaming (SSE) handling, non-streaming parsing, tool-calling mechanics, structured output modes (JSON and JSON Schema), model selection and variant usage, provider routing, and error/retry strategies. Practical code snippets and parameter recommendations guide implementation choices and parameter tuning.
When to use it
- Making chat completions or agent-driven conversations across many providers
- Implementing streaming real-time responses for chat UIs or terminals
- Enabling tool/function calling and executing model-driven workflows
- Enforcing structured outputs for APIs, databases, or automated pipelines
- Routing across providers and implementing model fallbacks for reliability
- Handling multimodal inputs (images, audio, video, PDFs) and embeddings
Best practices
- Always specify model and set max_tokens to control cost and avoid runaway output
- Use streaming for low-latency user-facing UIs and non-streaming for batch or synchronous processing
- Set temperature/top_p/top_k according to task (low for code/factual, higher for creative tasks)
- Provide explicit provider order and fallbacks when reliability or cost guarantees matter
- Wrap requests with exponential backoff and graceful handling for 429/5xx errors
- Use response_format/json_schema for strict, machine-parseable outputs when integrating downstream systems
Example use cases
- A chat application that streams assistant tokens to the client with progressive UI updates
- An agent that calls external tools (search, DB, APIs) via model-invoked tool calls and executes returned arguments
- Batch document analysis using large-context variants to process and summarize multi-file uploads
- Cost-optimized routing that prefers free or low-cost variants with automatic fallbacks to paid providers on failure
- A data extraction pipeline that requires strict JSON Schema output for downstream ingestion
FAQ
Use streaming for interactive, low-latency experiences and long outputs; use non-streaming for background jobs, short responses, or when you need the complete output before processing.
How do I force a specific tool or prevent tool calls?
Set tool_choice to a specific function object to force a tool, 'none' to disable, 'required' to mandate a tool, and keep 'auto' to let the model decide.