openrouter-generations

openrouterteam/skills

Метаданные и содержимое отдельных генераций OpenRouter: стоимость, задержка, токены

Звёзды326
Форки62
Авторopenrouterteam
Обновлённоя 11 2026

Установка

SKILL.md

openrouter-generations

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.

Prerequisites

  • Any valid OpenRouter API key (regular or management key). Get one at openrouter.ai/settings/keys.
  • Pass it via --api-key <key> or set the OPENROUTER_API_KEY environment variable
  • Generation IDs look like gen-1234567890 or gen-aBcDeFgHiJkLmNoPqRsT.

First-Time Setup

cd <skill-path>/scripts && npm install

Endpoints

EndpointMethodPurpose
/api/v1/generationGETRequest metadata and usage (tokens, cost, latency, model, provider)
/api/v1/generation/contentGETStored 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

Workflow

1. Get generation metadata

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:

  • Model & routing: model, provider_name, router, service_tier
  • Tokens: tokens_prompt, tokens_completion, native_tokens_reasoning, native_tokens_cached
  • Cost: total_cost, usage, upstream_inference_cost, cache_discount
  • Performance: latency, generation_time, moderation_latency
  • Status: finish_reason, streamed, cancelled, is_byok
  • Context: created_at, app_id, external_user, session_id, request_id
  • Provider chain: provider_responses array showing fallback attempts with per-provider latency and status

2. Get generation content

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:

  • Input: prompt (raw text) and/or messages (array of {role, content})
  • Output: completion (the model's response) and reasoning (chain-of-thought, if applicable)

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.

Direct API Usage (curl)

Get metadata

curl -G https://openrouter.ai/api/v1/generation \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -d id=gen-1234567890

Get content

curl -G https://openrouter.ai/api/v1/generation/content \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -d id=gen-1234567890

Response Schemas

Metadata response (/api/v1/generation)

{
  "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
      }
    ]
  }
}

Content response (/api/v1/generation/content)

{
  "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
    }
  }
}

Common Use Cases

Debug a failed generation

# 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:

  • finish_reason = "length" means the model hit max tokens
  • finish_reason = "content_filter" means content was filtered
  • cancelled = true means the request was cancelled by the client
  • provider_responses with multiple entries means fallbacks occurred

Check cost of a specific request

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).

Review what was actually sent/received

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.

Trace a multi-generation session

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).

Error Handling

StatusMeaning
401Invalid or missing API key
403You don't have access to this generation (belongs to another user)
404Generation ID not found
429Rate limited — wait and retry
500Server error — retry
502Upstream failure — retry

Key Fields Reference

Metadata fields

FieldTypeDescription
idstringGeneration ID (gen-...)
modelstringModel permaslug (e.g., openai/gpt-4o)
provider_namestring|nullProvider that served the request
api_typestringOne of: completions, embeddings, rerank, tts, stt, video
tokens_promptint|nullPrompt token count
tokens_completionint|nullCompletion token count
native_tokens_reasoningint|nullReasoning/thinking tokens
native_tokens_cachedint|nullCached input tokens
total_costnumberTotal cost in USD
usagenumberUsage amount in USD
upstream_inference_costnumber|nullProvider's cost in USD
cache_discountnumber|nullDiscount from caching
latencynumber|nullTotal latency in ms
generation_timenumber|nullModel generation time in ms
moderation_latencynumber|nullModeration check time in ms
finish_reasonstring|nullWhy generation stopped (stop, length, content_filter, etc.)
native_finish_reasonstring|nullRaw finish reason from provider
streamedbool|nullWhether response was streamed
is_byokboolWhether user's own provider key was used
cancelledbool|nullWhether request was cancelled
app_idint|nullOAuth app ID
external_userstring|nullExternal user identifier (X-External-User header)
session_idstring|nullSession grouping ID
request_idstring|nullRequest grouping ID (all gens from one API call)
routerstring|nullRouter used (e.g., openrouter/auto)
service_tierstring|nullProvider service tier
web_search_enginestring|nullSearch engine used (e.g., exa, firecrawl)
num_search_resultsint|nullNumber of search results included
provider_responsesarray|nullProvider attempt chain with per-provider latency/status

Content fields

FieldTypeDescription
data.input.promptstring|nullRaw prompt text
data.input.messagesarray|nullMessages array ([{role, content}])
data.output.completionstring|nullModel's completion text
data.output.reasoningstring|nullChain-of-thought reasoning

Вставить в README

Ссылка на карточку для вашего README — без картинок и счётчиков.

[DarkPlay: openrouter-generations](https://darkplay.ru/ai/skills/openrouterteam-skills-openrouter-generations)

Похожие скиллы и другие разделы каталога

Популярное в разделе «Скиллы»

Самые востребованные скиллов раздела по установкам и звёздам.

find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
4 400 000 устан.
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
1 600 000 устан.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
1 600 000 устан.
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
1 600 000 устан.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
1 600 000 устан.
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
1 500 000 устан.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
1 400 000 устан.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
1 300 000 устан.
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
1 300 000 устан.
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.
1 300 000 устан.
Похожее в других разделах каталога

Соседние разделы каталога: возможно, нужный инструмент живёт там.

bridge-dsanthropics · Генерация дизайна в Figma на основе вашей дизайн-системы с полным соблюдением компонентов…
38 комп.
byom-reviewanthropics · Код-ревью любой моделью через OpenRouter: стандартные и состязательные проверки со…
38 комп.
consensusanthropics · Собирает разные точки зрения ИИ параллельно: Consensus опрашивает GPT-5.2, Gemini 3.1 Pro…
38 комп.
enzymeanthropics · Семантическая индексация заметок Obsidian: кластеры по концепциям и тематические вопросы.
38 комп.
octoanthropics · Мульти-LLM оркестрация для Claude Code и Cowork: 8 провайдеров, workflow Double Diamond…
38 комп.
pok-dexanthropics · Полный Покедекс для Claude Code: 1025 покемонов поколений 1–9, статы, способности и база…
38 комп.
pokemon-pokedexanthropics · Покедекс для Claude Code: 1025 покемонов поколений 1–9 со статами, приёмами и типами.
38 комп.
openrouter-packjeremylongshore · Набор из 30 навыков для OpenRouter: маршрутизация LLM, выбор моделей и оптимизация затрат.
2 926 ★
openrouteropenrouterteam · Навыки для платформы OpenRouter
15 комп.
llm-routerjamesrochabrun · Маршрутизация запросов к LLM между провайдерами (OpenAI, Grok, Groq, DeepSeek) через…
46 комп.

Лучшие ИИ-инструменты для генерации видео

Генерация видео

Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,

VEED.IOVeed
По запросу
5.0
MootionMootion
По запросу
5.0
FlyviFlyvi
Есть бесплатный тариф
4.9
Google Veo 3.1Google
Платно
4.9
Sora (OpenAI)OpenAI
Платно
4.9
PikaPika
Платно
4.9
captions space
Есть бесплатный тариф
4.8
Клайп
Есть бесплатный тариф
4.8
viralpulse.appViralpulse
По запросу
4.8
Viral Maker AIViral-maker
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации текста и копирайтинга

Генерация текста и копирайтинг

Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра

NeuroscribeNeuroscribe
Есть бесплатный тариф
5.0
GoGPTGogpt
По запросу
5.0
ChatsonicChatsonic
По запросу
4.9
НейроТекстерNeuro-texter
По запросу
4.9
ChatGPTOpenAI
По подписке
4.9
Редактум
Есть бесплатный тариф
4.8
ChadGPTChadgpt
По запросу
4.8
Cosmo ScribeCosmoscribe
Есть бесплатный тариф
4.8
Memo HelperCopilot33
По запросу
4.8
LibraChatLibrachat
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации изображений

Генерация изображений

Подборка нейросетей для генерации изображений от фотореализма до концепт-арта. Сервисы, которые экономят часы ручной работы, создавая визуал для блогов, рекламы и дизайна за минуты

MagviMagvi
По запросу
5.0
DALL-E 3OpenAI
По подписке
5.0
SupaLabSupalab
По запросу
5.0
Freestyling.aiFreestyling
Есть бесплатный тариф
4.9
ArtGeneration.meArtgeneration
Есть бесплатный тариф
4.9
BigjpgBigjpg
По запросу
4.9
Художник от VKVK
Бесплатно
4.9
Wonderink — ИИ-книги
Есть бесплатный тариф
4.8
Avato AI12ai
По запросу
4.8
Virton AIVirton
По запросу
4.8