create-agent-tui
Scaffolds a complete agent TUI in TypeScript using @openrouter/agent — like create-react-app for terminal agents. Generates a…
Retrieve detailed metadata and stored content for individual OpenRouter generations. Use when the user wants to inspect a specific request — its cost, latency, token usage, provider routing, or the actual prompt/completion text — or is debugging a failed or unexpected generation.
$ npx -y skills add openrouterteam/skills --skill openrouter-generations --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/openrouter-generationsContext preview
The summary Claude sees to decide when to auto-load this skill.
Retrieve detailed metadata and stored content for individual OpenRouter generations. Use when the user wants to inspect a specific request — its cost, latency, token usage, provider routing, or the actual prompt/completion text — or is debugging a failed or unexpected generation.
name: openrouter-generations description: Retrieve detailed metadata and stored content for individual OpenRouter generations. Use when the user wants to inspect a specific request — its cost, latency, token usage, provider routing, or the actual prompt/completion text — or is debugging a failed or unexpected generation. version: 0.1.0
Retrieve detailed metadata and stored content for individual OpenRouter generations. Use this skill when you need to inspect a specific request — its cost, latency, token usage, provider routing, or the actual prompt/completion text.
cd <skill-path>/scripts && npm install
| Endpoint | Method | Purpose | |----------|--------|---------| | `/api/v1/generation` | GET | Request metadata and usage (tokens, cost, latency, model, provider) | | `/api/v1/generation/content` | GET | Stored prompt and completion text |
Both take a single query parameter: `id` (the generation ID).
Full API reference: [openrouter.ai/docs/api/api-reference/generations/get-generation](https://openrouter.ai/docs/api/api-reference/generations/get-generation)
Retrieves everything about a generation *except* the actual prompt/completion text:
cd <skill-path>/scripts && npx tsx get-generation.ts gen-1234567890 npx tsx get-generation.ts --id gen-1234567890 --json
**What you get back:**
Retrieves the stored prompt and completion:
cd <skill-path>/scripts && npx tsx get-generation-content.ts gen-1234567890 npx tsx get-generation-content.ts --id gen-1234567890 --json
**What you get back:**
**Note:** Content is only available if the generation was *not* made with Zero Data Retention (ZDR) enabled. If ZDR was on, this endpoint returns empty/null content.
curl -G https://openrouter.ai/api/v1/generation \ -H "Authorization: Bearer $OPENROUTER_API_KEY" \ -d id=gen-1234567890
curl -G https://openrouter.ai/api/v1/generation/content \ -H "Authorization: Bearer $OPENROUTER_API_KEY" \ -d id=gen-1234567890
{
"data": {
"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG",
"api_type": "completions",
"model": "openai/gpt-4o",
"provider_name": "OpenAI",
"created_at": "2024-07-15T23:33:19.433273+00:00",
"tokens_prompt": 10,
"tokens_completion": 25,
"native_tokens_reasoning": 5,
"native_tokens_cached": 3,
"total_cost": 0.0015,
"usage": 0.0015,
"upstream_inference_cost": 0.0012,
"latency": 1250,
"generation_time": 1200,
"finish_reason": "stop",
"streamed": true,
"is_byok": false,
"cancelled": false,
"router": "openrouter/auto",
"service_tier": "priority",
"provider_responses": [
{
"provider_name": "OpenAI",
"model_permaslug": "openai/gpt-4o",
"status": 200,
"latency": 1200,
"is_byok": false
}
]
}
}{
"data": {
"input": {
"prompt": "What is the meaning of life?",
"messages": [
{
"content": "What is the meaning of life?",
"role": "user"
}
]
},
"output": {
"completion": "The meaning of life is a philosophical question...",
"reasoning": null
}
}
}# Check what happened — look at finish_reason, provider_responses, and cancelled cd <skill-path>/scripts && npx tsx get-generation.ts gen-abc123 --json
Look for:
cd <skill-path>/scripts && npx tsx get-generation.ts gen-abc123
Check `total_cost` (what you were charged) vs `upstream_inference_cost` (what the provider charged OpenRouter).
cd <skill-path>/scripts && npx tsx get-generation-content.ts gen-abc123
Useful for debugging unexpected outputs — verify the actual prompt sent and completion received.
If you have a `request_id` or `session_id` from one generation, you can find related generations via the analytics query endpoint (see `openrouter-analytics` skill).
| Status | Meaning | |--------|---------| | 401 | Invalid or missing API key | | 403 | You don't have access to this generation (belongs to another user) | | 404 | Generation ID not found | | 429 | Rate limited — wait
A collection of Agent Skills for building with OpenRouter — a unified API for 600+ AI models.
Scaffolds a complete agent TUI in TypeScript using @openrouter/agent — like create-react-app for terminal agents. Generates a…
Scaffolds a headless agent in TypeScript using @openrouter/agent and Bun — for CLI tools, API servers, queue workers, and…
Install Ori and run the user's existing coding agent CLI through Ori on OpenRouter, with OAuth sign-in, model selection,…
Migration guide from @openrouter/sdk to @openrouter/agent for callModel, tool(), stop conditions, and agent features. This skill…
Construct and execute analytics queries against the OpenRouter API — full parameter reference for metrics, dimensions, filters,…
Discover the OpenRouter analytics schema — available metrics, dimensions, filter operators, and granularities. Use when you need…