• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdevelopment

output-dev-workflow-cost

プラグイン
outputai
ソース
GitHub で見る ↗
説明

Output SDKワークフロー実行の実行コストを計算して表示します。 次のような場合に使用: - LLM トークンのコストを確認したい - API サービスのコストを確認したい - 特定のワークフロー実行の総支出を確認したい

原文を表示

Calculate and display the cost of an Output SDK workflow execution run. Use when checking LLM token costs, API service costs, or total spend for a specific workflow run.

ユースケース
  • LLMトークンのコストを確認したい
  • APIサービスのコストを確認したい
  • ワークフロー実行の総支出を確認したい
本文(日本語訳)

ワークフロー実行コスト

概要

このスキルは、Output CLIを使用して完了したワークフロー実行のコストを計算するのに役立ちます。LLMモデル(トークン使用量)と外部APIサービス呼び出しごとにコストを詳細に表示します。

次のような場合に使用

  • ワークフロー実行がLLMトークンでいくらかかったかを確認したい
  • ワークフロー実行ごとのAPIサービス利用コストを分析したい
  • 複数のワークフロー実行のコストを比較したい
  • デモやレビューの際にコスト情報を提示したい

ステップ1: ワークフロー実行IDを取得する

workflow costコマンドには、ワークフロー名ではなくワークフロー実行IDが必要です。

実行IDの例: process_transcripts_2026-03-23T19:35:17.000Z_c2biRk_F9rYktF-wagBf5

すでに実行IDを持っている場合は、ステップ2に進んでください。

実行IDを持っていない場合:

方法A — 最近の実行を一覧表示 (スキル使用: output-workflow-runs-list):

npx output workflow runs list <workflowName> --limit 5

最も最近に完了した実行から実行IDをコピーします。

方法B — ワークフローを実行して実行IDを取得:

入力値がわかっている場合は、同期実行すると実行IDが出力に表示されます:

npx output workflow run <workflowName> --input '{"key": "value"}'

非同期実行の場合 (スキル使用: output-workflow-start):

npx output workflow start <workflowName> --input '{"key": "value"}'
# 出力: Workflow ID: <runId>

入力値がわからない場合は、シナリオファイル (スキル使用: output-dev-scenario-file) またはワークフローのtypes.ts内のinputSchemaを確認してください。

注記: ワークフロー名(例: process_transcripts)はワークフローの種類を識別します。ワークフロー実行ID(例: process_transcripts_2026-03-23T19:35:17.000Z_abc123)は特定の実行を識別します。workflow costは実行IDが必要です。


ステップ2: コストを計算する

基本的な使用方法(テキスト出力):

npx output workflow cost <runId>

ローカルのトレースファイルを使用:

npx output workflow cost <runId> path/to/trace.json

JSON出力(プログラム処理や表示用):

npx output workflow cost <runId> --json

詳細表示 — 呼び出しごとの内訳を表示:

npx output workflow cost <runId> --verbose

すべてのフラグ:

フラグ 説明 デフォルト
--json テキストレポートの代わりに機械可読なJSON形式で出力 false
--verbose LLM呼び出しごとの詳細な内訳を表示 false

出力の見方

テキスト形式の例:

価格値は説明用です — 下記のモデルと1トークンあたりのレートは2026年5月4日時点のものです。現在の価格はmodels.devから取得されます。現在のモデルIDについては、output-dev-model-selectionを参照してください。

各行のコストは2つの数値で表示されます。Originalはトレース属性(llm:generation:cost / http:request:cost、llm:generation:usageとllm:usageが存在する場合)に記録された請求額コストです。Adjustedはcosts.ymlオーバーライドを適用後のコストです(オーバーライドがない場合はOriginalと同じ)。合計行とJSON形式のtotalCostは調整後の合計を表します。

Workflow: process_transcripts
Duration: 12.3s

LLM Costs:
  Model              | Calls | Original | Adjusted
  claude-sonnet-4-6  |     3 |  $0.0123 |  $0.0123
  Subtotal           |     3 |  $0.0123 |  $0.0123

API Costs:
  Host       | Calls | Original | Adjusted
  r.jina.ai  |     2 |  $0.0040 |  $0.0040
  Subtotal   |     2 |  $0.0040 |  $0.0040

TOTAL ESTIMATED COST (adjusted)   $0.0163
As-charged (from trace)           $0.0163

APIコストには、クライアントがaddRequestCostで金額を付与した呼び出しのみが含まれます(output-dev-http-client-createの「リクエストコストの付与(有料API)」を参照)。addRequestCostを呼び出さないHTTP呼び出しはトレースされますが、ここには貢献しません — これは無料サービスや社内サービスでは正常ですが、有料サービスの場合は改善の余地があります。

JSON形式のフィールド:

{
  "workflowName": "process_transcripts",
  "durationMs": 12300,
  "llmOriginalCost": 0.0123,
  "llmAdjustedCost": 0.0123,
  "totalInputTokens": 1234,
  "totalOutputTokens": 567,
  "httpCosts": [{ "host": "r.jina.ai", "originalTotalCost": 0.004, "adjustedTotalCost": 0.004 }],
  "httpOriginalCost": 0.004,
  "httpAdjustedCost": 0.004,
  "originalTotalCost": 0.0163,
  "totalCost": 0.0163
}

llmCallsとhttpCosts[].calls内の呼び出し単位エントリはoriginalCostとadjustedCostを含みます。(より古いリリースではllmTotalCost、services[]、serviceTotalCost、unknownModelsが公開されていましたが、上記のフィールドで置き換わりました。)


使用例

最後の実行のコストを取得:

# まず実行IDを取得
npx output workflow runs list process_transcripts --limit 1 --json

# 次にコストを取得
npx output workflow cost process_transcripts_2026-03-23T19:35:17.000Z_abc123

コストをJSON形式で取得して合計を抽出:

npx output workflow cost <runId> --json | jq '.totalCost'

呼び出しごとの詳細な内訳を表示:

npx output workflow cost <runId> --verbose

関連スキル

  • output-workflow-runs-list — 実行履歴から実行IDを検索
  • output-workflow-start — ワークフローを開始して実行IDを取得
  • output-workflow-run — ワークフローを同期実行
  • output-dev-scenario-file — ワークフロー入力用のシナリオファイルを作成・検索
原文(English)を表示

Workflow Run Cost

Overview

This skill helps you calculate the cost of a completed workflow execution using the Output CLI. It breaks down costs by LLM model (token usage) and external API service calls.

When to Use This Skill

  • Checking how much a workflow run cost in LLM tokens
  • Analyzing API service spend per workflow execution
  • Comparing costs between workflow runs
  • Presenting cost data during a demo or review

Step 1: Get a Workflow Run ID

The workflow cost command requires a workflow run ID — not the workflow name.

A run ID looks like: process_transcripts_2026-03-23T19:35:17.000Z_c2biRk_F9rYktF-wagBf5

If you already have a run ID, skip to Step 2.

If you don't have a run ID:

Option A — List recent runs (use skill: output-workflow-runs-list):

npx output workflow runs list <workflowName> --limit 5

Copy the run ID from the most recent completed run.

Option B — Run the workflow now and capture the ID:

If you know the input, run it synchronously and the run ID will be in the output:

npx output workflow run <workflowName> --input '{"key": "value"}'

Or asynchronously (use skill: output-workflow-start):

npx output workflow start <workflowName> --input '{"key": "value"}'
# Returns: Workflow ID: <runId>

If you don't know the input, check for a scenario file (use skill: output-dev-scenario-file) or the workflow's inputSchema in its types.ts.

Note: The workflow name (e.g. process_transcripts) identifies the workflow type. The workflow run ID (e.g. process_transcripts_2026-03-23T19:35:17.000Z_abc123) identifies a specific execution. workflow cost requires the run ID.


Step 2: Calculate the Cost

Basic usage (text output):

npx output workflow cost <runId>

With a local trace file:

npx output workflow cost <runId> path/to/trace.json

JSON output (for programmatic use or display):

npx output workflow cost <runId> --json

Verbose — show per-call breakdown:

npx output workflow cost <runId> --verbose

All flags:

Flag Description Default
--json Output machine-readable JSON instead of the text report false
--verbose Show detailed per-LLM-call breakdown false

Understanding the Output

Text format example:

Pricing values are illustrative — the model and per-token rates shown below were current as of 2026-05-04. Live pricing comes from models.dev. For current model IDs, see output-dev-model-selection.

Costs come in two figures per row: Original is the as-charged cost recorded in the trace attributes (llm:generation:cost / http:request:cost, with llm:generation:usage and legacy llm:usage fallbacks), and Adjusted is the cost after applying any costs.yml override (equal to Original when no override applies). The bottom line and JSON totalCost are the Adjusted total.

Workflow: process_transcripts
Duration: 12.3s

LLM Costs:
  Model              | Calls | Original | Adjusted
  claude-sonnet-4-6  |     3 |  $0.0123 |  $0.0123
  Subtotal           |     3 |  $0.0123 |  $0.0123

API Costs:
  Host       | Calls | Original | Adjusted
  r.jina.ai  |     2 |  $0.0040 |  $0.0040
  Subtotal   |     2 |  $0.0040 |  $0.0040

TOTAL ESTIMATED COST (adjusted)   $0.0163
As-charged (from trace)           $0.0163

API Costs only include calls where the client attached a dollar amount with addRequestCost (see output-dev-http-client-create, "Attaching Request Cost (Paid APIs)"). An HTTP call that never calls addRequestCost is still traced but contributes nothing here — that's expected for free or internal services, and a gap to fix for paid ones.

JSON format fields:

{
  "workflowName": "process_transcripts",
  "durationMs": 12300,
  "llmOriginalCost": 0.0123,
  "llmAdjustedCost": 0.0123,
  "totalInputTokens": 1234,
  "totalOutputTokens": 567,
  "httpCosts": [{ "host": "r.jina.ai", "originalTotalCost": 0.004, "adjustedTotalCost": 0.004 }],
  "httpOriginalCost": 0.004,
  "httpAdjustedCost": 0.004,
  "originalTotalCost": 0.0163,
  "totalCost": 0.0163
}

Per-call entries in llmCalls and httpCosts[].calls carry originalCost and adjustedCost. (Older releases exposed llmTotalCost, services[], serviceTotalCost, and unknownModels — replaced by the fields above.)


Examples

Get cost of the last run:

# First get the run ID
npx output workflow runs list process_transcripts --limit 1 --json

# Then get the cost
npx output workflow cost process_transcripts_2026-03-23T19:35:17.000Z_abc123

Get cost as JSON and extract total:

npx output workflow cost <runId> --json | jq '.totalCost'

Show full per-call breakdown:

npx output workflow cost <runId> --verbose

Related Skills

  • output-workflow-runs-list — Find run IDs from execution history
  • output-workflow-start — Start a workflow and capture its run ID
  • output-workflow-run — Run a workflow synchronously
  • output-dev-scenario-file — Create or find scenario files for workflow input

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。