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.
このスキルは、出力CLI(コマンドラインツール)を使ってワークフローの実行にかかったコストを計算するのに役立ちます。言語モデルのトークン使用量と外部API呼び出しごとに、コストを細かく分けて表示します。
workflow cost コマンドには、ワークフロー実行IDが必要です。ワークフロー名ではなく、実行IDを指定してください。
実行IDの例: process_transcripts_2026-03-23T19:35:17.000Z_c2biRk_F9rYktF-wagBf5
方法A — 最近の実行履歴から探す(スキル output-workflow-runs-list を使用):
npx output workflow runs list <ワークフロー名> --limit 5
最も最近の完了した実行から実行IDをコピーしてください。
方法B — ワークフローを実行して、表示される実行IDをメモする:
入力データがわかっている場合は、その場で実行すると出力に実行IDが表示されます:
npx output workflow run <ワークフロー名> --input '{"key": "value"}'
非同期で実行する場合(スキル output-workflow-start を使用):
npx output workflow start <ワークフロー名> --input '{"key": "value"}'
# 出力: Workflow ID: <実行ID>
入力データがわからない場合は、シナリオファイル(スキル output-dev-scenario-file で確認)またはワークフローの types.ts にある inputSchema をチェックしてください。
注釈: ワークフロー名(例:
process_transcripts)はワークフロー種別を特定します。ワークフロー実行ID(例:process_transcripts_2026-03-23T19:35:17.000Z_abc123)は特定の1回の実行を特定します。workflow costコマンドには実行IDが必要です。
npx output workflow cost <実行ID>
npx output workflow cost <実行ID> path/to/trace.json
npx output workflow cost <実行ID> --json
npx output workflow cost <実行ID> --verbose
| オプション | 説明 | デフォルト |
|---|---|---|
--json |
テキストレポートではなく、機械可読なJSON形式で出力 | false |
--verbose |
言語モデル呼び出しごとの詳細内訳を表示 | false |
料金の数値は説明用です。下記に示すモデルと1トークンあたりの料金は、2026年5月4日時点のものです。最新の料金は models.dev から取得しています。現在のモデルIDについては、
output-dev-model-selectionを参照してください。
各行に2つのコスト数値が表示されます:Original はトレースイベント(llm:usage / http:request:cost)に記録された請求額です。Adjusted は costs.yml で設定したコスト上書き(オーバーライド)を適用後の額です。上書きがない場合、両者は同じです。最下部と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
{
"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 <実行ID> --json | jq '.totalCost'
1回の呼び出しごとの詳細な内訳を表示:
npx output workflow cost <実行ID> --verbose
output-workflow-runs-list — 実行履歴から実行IDを探すoutput-workflow-start — ワークフローを開始して実行IDを取得するoutput-workflow-run — ワークフローをその場で実行するoutput-dev-scenario-file — ワークフロー入力用のシナリオファイルを作成・検索する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.
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
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 costrequires the run ID.
npx output workflow cost <runId>
npx output workflow cost <runId> path/to/trace.json
npx output workflow cost <runId> --json
npx output workflow cost <runId> --verbose
| Flag | Description | Default |
|---|---|---|
--json |
Output machine-readable JSON instead of the text report | false |
--verbose |
Show detailed per-LLM-call breakdown | false |
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 events (llm:usage / http:request:cost), 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
{
"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.)
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
output-workflow-runs-list — Find run IDs from execution historyoutput-workflow-start — Start a workflow and capture its run IDoutput-workflow-run — Run a workflow synchronouslyoutput-dev-scenario-file — Create or find scenario files for workflow input原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。