SKILL

cost-aware-llm-pipeline

LLM APIの使用量のコスト最適化パターン — タスクの複雑さによるモデルルーティング、予算追跡、リトライロジック、プロンプトキャッシング。

Original · translation is not supported for this source language

Target: AI & workflow automation. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original Japanese text

Topics in the source

  • コスト認識LLMパイプライン
  • 起動条件
  • コアコンセプト
  • 1. タスクの複雑さによるモデルルーティング
  • 2. 不変のコスト追跡
  • 3. 狭いリトライロジック
  • 4. プロンプトキャッシング
  • 合成

品質を維持しながらLLM APIのコストをコントロールするためのパターン。モデルルーティング、予算追跡、リトライロジック、プロンプトキャッシングを組み合わせた合成可能なパイプライン。 LLM APIを呼び出すアプリケーションの構築(Claude、GPTなど) 複雑さが異なるアイテムのバッチ処理 API支出の予算内に収める必要がある場合 複雑なタスクの品質を犠牲にせずにコストを最適化する場合 シンプルなタスクには自動的に安価なモデルを選択し、複雑なタスクのために高価なモデルを予約します。 凍結データクラスで累積支出を追跡します。各API呼び出しは新しいトラッカーを返します — 状態を変更しません。 一時的なエラーのみリトライします。認証やリクエストエラーでは素早く失敗します。 長いシステムプロンプトをキャッシュして、リクエストごとに再送信しないようにします。 4つのテクニックすべてを単一のパイプライン関数に組み合わせます: | モデル | 入力($/1Mトークン) | 出力($/1Mトークン) | 相対コスト | |-------|---------------------|----------------------|---------------| | Haiku 3.5 (legacy) | $0.80 | $4.00 | 0.8x | | Haiku 4.5 | $1.00 | $5.00 | 1x | | Sonnet 5 | $2.00 | $10.00 | 2x | | Sonnet 4.6 | $3.00 | $15.00 | 3x | | Opus 4.8 | $5.00 | $25.00 | 5x | | Fable 5 / Mythos 5 | $10.00 | $50.00 | 10x | | Opus 4.0 / 4.1 (legacy) | $15.00 | $75.00 | 15x | 最も安価なモデルから始める、複雑さの閾値が満たされた場合にのみ高価なモデルにルーティングする バッチ処理の前に明示的な予算制限を設定する — 過剰支出より早期に失敗する モデル選択の決定をログに記録する、実際のデータに基づいて閾値を調整できるように 1024トークンを超えるシステムプロンプトにはプロンプトキャッシングを使用する — コストとレイテンシーの両方を節約 認証またはバリデーションエラーではリトライしない — 一時的な失敗のみ(ネットワーク、レート制限、サーバーエラー) 複雑さに関わらずすべてのリクエストに最も高価なモデルを使用すること すべてのエラーでリトライすること(永続的な失敗で予算を無駄にする) コスト追跡の状態を変更すること(デバッグと監査が困難になる) コードベース全体にモデル名をハードコードすること(定数または設定を使用する)

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
affaan-m/ECC
Source file
docs/ja-JP/skills/cost-aware-llm-pipeline/SKILL.md
Fixed revision
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Read the complete original documentation ↗

Requirements

  • Only the author’s Skill metadata is included. Read the full instructions to check dependencies, licensing and conditions of use.

A small first task

先阅读原作者说明,再决定是否在自己的 AI 工具中使用。

Instructions for your AI tool

Author documentation is not live verification by this site. Without evidence, we do not mark a resource as compatible, safe or free.

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T14:01:49.064Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.