chompyy 0.4.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -6
- package/dist/advice.js +2 -1
- package/dist/agentlimits.js +77 -0
- package/dist/agentusage.js +96 -0
- package/dist/appstate.js +72 -5
- package/dist/away.js +44 -5
- package/dist/blueprint.js +3 -7
- package/dist/board.js +4 -0
- package/dist/cli.js +328 -15
- package/dist/codexquota.js +106 -0
- package/dist/codexusage.js +10 -0
- package/dist/config.js +2 -0
- package/dist/context.js +30 -0
- package/dist/costs.js +1 -0
- package/dist/daytime.js +68 -0
- package/dist/demon.js +20 -0
- package/dist/didwork.js +46 -0
- package/dist/label.js +33 -0
- package/dist/learning.js +35 -0
- package/dist/menu.js +17 -0
- package/dist/nightcap.js +60 -0
- package/dist/nudge.js +47 -18
- package/dist/pacing.js +16 -1
- package/dist/questions.js +71 -0
- package/dist/recap.js +74 -0
- package/dist/receipt.js +48 -0
- package/dist/recipe.js +79 -0
- package/dist/send.js +46 -20
- package/dist/stamps.js +14 -0
- package/dist/taste.js +67 -7
- package/dist/triggers.js +5 -0
- package/dist/unkeep.js +220 -0
- package/dist/usage.js +21 -1
- package/dist/vendor/codeburn/antigravity.js +309 -0
- package/dist/vendor/codeburn/codex.js +429 -0
- package/dist/vendor/codeburn/copilot.js +292 -0
- package/dist/vendor/codeburn/gemini.js +195 -0
- package/dist/vendor/codeburn/grokbot.js +182 -0
- package/dist/vendor/codeburn/kimi.js +178 -0
- package/dist/vendor/codeburn/shims/chalk.js +14 -0
- package/dist/vendor/codeburn/shims/strip-ansi.js +6 -0
- package/dist/vendor/codeburn/src/act/backup.js +83 -0
- package/dist/vendor/codeburn/src/act/model-defaults.js +151 -0
- package/dist/vendor/codeburn/src/act/types.js +37 -0
- package/dist/vendor/codeburn/src/bash-utils.js +204 -0
- package/dist/vendor/codeburn/src/behavioral-weight.js +47 -0
- package/dist/vendor/codeburn/src/cache-dir.js +26 -0
- package/dist/vendor/codeburn/src/cache-refresh-lock.js +543 -0
- package/dist/vendor/codeburn/src/cache-sweep.js +67 -0
- package/dist/vendor/codeburn/src/classifier.js +209 -0
- package/dist/vendor/codeburn/src/claude-identity.js +223 -0
- package/dist/vendor/codeburn/src/codex-cache.js +377 -0
- package/dist/vendor/codeburn/src/codex-fork-replay.js +232 -0
- package/dist/vendor/codeburn/src/codex-jsonl-fields.js +99 -0
- package/dist/vendor/codeburn/src/codex-session-index.js +113 -0
- package/dist/vendor/codeburn/src/codex-throughput.js +544 -0
- package/dist/vendor/codeburn/src/compare-stats.js +405 -0
- package/dist/vendor/codeburn/src/config.js +145 -0
- package/dist/vendor/codeburn/src/content-utils.js +56 -0
- package/dist/vendor/codeburn/src/context-tree-codex.js +329 -0
- package/dist/vendor/codeburn/src/context-tree.js +664 -0
- package/dist/vendor/codeburn/src/copilot-aiu.js +16 -0
- package/dist/vendor/codeburn/src/currency.js +189 -0
- package/dist/vendor/codeburn/src/cursor-cache.js +238 -0
- package/dist/vendor/codeburn/src/cursor-import.js +402 -0
- package/dist/vendor/codeburn/src/cursor-sync.js +256 -0
- package/dist/vendor/codeburn/src/daily-cache.js +2036 -0
- package/dist/vendor/codeburn/src/data/litellm-snapshot.json +1 -0
- package/dist/vendor/codeburn/src/data/pricing-fallback.json +1 -0
- package/dist/vendor/codeburn/src/day-aggregator.js +327 -0
- package/dist/vendor/codeburn/src/editor-data-dir.js +11 -0
- package/dist/vendor/codeburn/src/fetch-utils.js +18 -0
- package/dist/vendor/codeburn/src/format.js +118 -0
- package/dist/vendor/codeburn/src/fs-utils.js +270 -0
- package/dist/vendor/codeburn/src/git-origin.js +334 -0
- package/dist/vendor/codeburn/src/granular-history.js +328 -0
- package/dist/vendor/codeburn/src/hermes-session-ledger.js +512 -0
- package/dist/vendor/codeburn/src/launcher-homes.js +142 -0
- package/dist/vendor/codeburn/src/live-sessions.js +358 -0
- package/dist/vendor/codeburn/src/math-utils.js +8 -0
- package/dist/vendor/codeburn/src/menubar-json.js +294 -0
- package/dist/vendor/codeburn/src/models.js +1879 -0
- package/dist/vendor/codeburn/src/optimize-one-hour-cache.js +92 -0
- package/dist/vendor/codeburn/src/optimize.js +4110 -0
- package/dist/vendor/codeburn/src/parse-workers.js +219 -0
- package/dist/vendor/codeburn/src/parser.js +6953 -0
- package/dist/vendor/codeburn/src/path-privacy.js +26 -0
- package/dist/vendor/codeburn/src/plans.js +135 -0
- package/dist/vendor/codeburn/src/pr-signals.js +132 -0
- package/dist/vendor/codeburn/src/project-filter-warnings.js +33 -0
- package/dist/vendor/codeburn/src/provider-issues.js +30 -0
- package/dist/vendor/codeburn/src/providers/amp.js +286 -0
- package/dist/vendor/codeburn/src/providers/antigravity.js +1731 -0
- package/dist/vendor/codeburn/src/providers/claude.js +551 -0
- package/dist/vendor/codeburn/src/providers/cline-cli.js +401 -0
- package/dist/vendor/codeburn/src/providers/cline.js +63 -0
- package/dist/vendor/codeburn/src/providers/codebuff.js +336 -0
- package/dist/vendor/codeburn/src/providers/codewhale.js +442 -0
- package/dist/vendor/codeburn/src/providers/codex.js +1720 -0
- package/dist/vendor/codeburn/src/providers/command-code.js +196 -0
- package/dist/vendor/codeburn/src/providers/copilot.js +3278 -0
- package/dist/vendor/codeburn/src/providers/crush.js +226 -0
- package/dist/vendor/codeburn/src/providers/cursor-agent.js +837 -0
- package/dist/vendor/codeburn/src/providers/cursor.js +1163 -0
- package/dist/vendor/codeburn/src/providers/devin.js +569 -0
- package/dist/vendor/codeburn/src/providers/droid.js +324 -0
- package/dist/vendor/codeburn/src/providers/dsh.js +690 -0
- package/dist/vendor/codeburn/src/providers/forge.js +245 -0
- package/dist/vendor/codeburn/src/providers/gemini.js +230 -0
- package/dist/vendor/codeburn/src/providers/goose.js +252 -0
- package/dist/vendor/codeburn/src/providers/grok.js +581 -0
- package/dist/vendor/codeburn/src/providers/grokbot.js +290 -0
- package/dist/vendor/codeburn/src/providers/hermes.js +771 -0
- package/dist/vendor/codeburn/src/providers/ibm-bob.js +53 -0
- package/dist/vendor/codeburn/src/providers/index.js +360 -0
- package/dist/vendor/codeburn/src/providers/kilo-code.js +50 -0
- package/dist/vendor/codeburn/src/providers/kimi.js +363 -0
- package/dist/vendor/codeburn/src/providers/kimicode.js +402 -0
- package/dist/vendor/codeburn/src/providers/kiro.js +1174 -0
- package/dist/vendor/codeburn/src/providers/lingtai-tui.js +372 -0
- package/dist/vendor/codeburn/src/providers/mistral-vibe-unified.js +236 -0
- package/dist/vendor/codeburn/src/providers/mistral-vibe.js +405 -0
- package/dist/vendor/codeburn/src/providers/mux.js +242 -0
- package/dist/vendor/codeburn/src/providers/open-design.js +217 -0
- package/dist/vendor/codeburn/src/providers/openclaude.js +309 -0
- package/dist/vendor/codeburn/src/providers/openclaw.js +442 -0
- package/dist/vendor/codeburn/src/providers/opencode-file-parser.js +131 -0
- package/dist/vendor/codeburn/src/providers/opencode.js +91 -0
- package/dist/vendor/codeburn/src/providers/pi.js +429 -0
- package/dist/vendor/codeburn/src/providers/quickdesk.js +491 -0
- package/dist/vendor/codeburn/src/providers/qwen.js +193 -0
- package/dist/vendor/codeburn/src/providers/session-message.js +118 -0
- package/dist/vendor/codeburn/src/providers/sqlite-session-parser.js +457 -0
- package/dist/vendor/codeburn/src/providers/types.js +5 -0
- package/dist/vendor/codeburn/src/providers/vercel-gateway.js +135 -0
- package/dist/vendor/codeburn/src/providers/vscode-cline-parser.js +212 -0
- package/dist/vendor/codeburn/src/providers/warp.js +575 -0
- package/dist/vendor/codeburn/src/providers/zcode.js +249 -0
- package/dist/vendor/codeburn/src/providers/zed.js +187 -0
- package/dist/vendor/codeburn/src/providers/zerostack.js +139 -0
- package/dist/vendor/codeburn/src/quota/antigravity.js +310 -0
- package/dist/vendor/codeburn/src/quota/claude.js +244 -0
- package/dist/vendor/codeburn/src/quota/cursor.js +301 -0
- package/dist/vendor/codeburn/src/quota/security.js +299 -0
- package/dist/vendor/codeburn/src/quota/types.js +1 -0
- package/dist/vendor/codeburn/src/scan-facts.js +99 -0
- package/dist/vendor/codeburn/src/session-cache.js +3040 -0
- package/dist/vendor/codeburn/src/session-count-label.js +14 -0
- package/dist/vendor/codeburn/src/session-output.js +139 -0
- package/dist/vendor/codeburn/src/session-population.js +30 -0
- package/dist/vendor/codeburn/src/sessions-report.js +1342 -0
- package/dist/vendor/codeburn/src/sqlite.js +528 -0
- package/dist/vendor/codeburn/src/sync/otlp.js +420 -0
- package/dist/vendor/codeburn/src/telemetry-snapshot.js +244 -0
- package/dist/vendor/codeburn/src/token-estimate.js +5 -0
- package/dist/vendor/codeburn/src/types.js +16 -0
- package/dist/vendor/codeburn/src/work-units.js +126 -0
- package/dist/vendor/codeburn/src/workflow-insights.js +228 -0
- package/dist/vendor/codeburn/src/wsl.js +198 -0
- package/dist/vendor/codeburn/src/yield.js +666 -0
- package/package.json +11 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "qvq-max": [0.0000012, 0.0000048, null, null, null], "qwen-flash": [5.0000000000000004e-8, 4.0000000000000003e-7, 6.25e-8, 1e-8, null], "qwen-mt-turbo": [1.6e-7, 4.9e-7, null, null, null], "qwen-omni-turbo": [7e-8, 2.7e-7, null, null, null], "qwen-omni-turbo-realtime": [2.7e-7, 0.0000010700000000000001, null, null, null], "qwen-plus-character-ja": [5e-7, 0.0000014, null, null, null], "qwen-vl-max": [8.000000000000001e-7, 0.0000032000000000000003, null, null, null], "qwen-vl-ocr": [7e-8, 1.6e-7, null, null, null], "qwen2-5-omni-7b": [1.0000000000000001e-7, 4.0000000000000003e-7, null, null, null], "qwen3-livetranslate-flash-realtime": [0.00001, 0.00001, null, null, null], "qwen3-omni-flash": [4.3e-7, 0.00000166, null, null, null], "qwen3-omni-flash-realtime": [5.2e-7, 0.00000199, null, null, null], "qwen3-vl-235b-a22b": [7e-7, 0.0000028, null, null, null], "qwen3-vl-30b-a3b": [2.0000000000000002e-7, 8.000000000000001e-7, null, null, null], "qwen3-vl-plus": [2.0000000000000002e-7, 0.0000016000000000000001, 2.5e-7, 4e-8, null], "qwen3.5-flash": [1.0000000000000001e-7, 4.0000000000000003e-7, 1.25e-7, 1e-8, null], "deepseek-v3-1": [5.739999999999999e-7, 0.0000017210000000000001, null, null, null], "deepseek-v3-2-exp": [2.8699999999999996e-7, 4.31e-7, null, null, null], "moonshot-kimi-k2-instruct": [5.739999999999999e-7, 0.000002294, null, null, null], "qwen-deep-research": [0.000007742, 0.000023367000000000002, null, null, null], "qwen-doc-turbo": [8.7e-8, 1.44e-7, null, null, null], "qwen-long": [7.2e-8, 2.8699999999999996e-7, null, null, null], "qwen-math-plus": [5.739999999999999e-7, 0.0000017210000000000001, null, null, null], "qwen-math-turbo": [2.8699999999999996e-7, 8.61e-7, null, null, null], "qwen-plus-character": [1.1500000000000001e-7, 2.8699999999999996e-7, null, null, null], "tongyi-intent-detect-v3": [5.8e-8, 1.44e-7, null, null, null], "command-a-reasoning-08-2025": [0.0000025, 0.00001, null, null, null], "command-a-translate-08-2025": [0.0000025, 0.00001, null, null, null], "command-a-vision-07-2025": [0.0000025, 0.00001, null, null, null], "command-r7b-arabic-02-2025": [3.75e-8, 1.5e-7, null, null, null], "claude-opus-4-1": [0.000015, 0.000075, 0.00001875, 0.0000015, null], "mercury-3": [1.0000000000000001e-7, 3.5e-7, null, 1e-8, null], "mistral-large-4-0-8": [7e-7, 0.0000021000000000000002, null, 7e-8, null], "mistral-medium-2508": [4.0000000000000003e-7, 0.000002, null, null, null], "mistral-small-2506": [1.0000000000000001e-7, 3e-7, null, null, null], "morph-glm52-744b": [0.00000119, 0.000006, null, 1.955e-7, null], "morph-kimik31": [0.0000025, 0.000014, null, 2.9e-7, null], "gpt-5.3-codex-spark": [0.00000175, 0.000014, null, 1.75e-7, null], "gpt-image-2": [0.000005, 0.00003, null, 0.00000125, null], "glm-4.7-flashx": [7.47e-8, 4.4819e-7, 0, 1.494e-8, null], "lfm-3-1.7b": [8e-8, 2e-7, null, 2e-8, null], "glm-5.3-flashx-legal": [3.7e-7, 0.00000125, null, 7.5e-8, null], "particle-1": [5e-8, 5e-7, null, 3e-9, null], "gpt-6.1-terra-pro": [0.000001, 0.000005, 0.00000125, 5e-8, null], "gpt-6.1-terra-pro:batch": [5e-7, 0.0000025, 6.25e-7, 2.5e-8, null], "gpt-6.1-terra:batch": [5e-7, 0.0000025, 6.25e-7, 2.5e-8, null], "glimpse": [6e-7, 0.000003, null, 6e-8, null], "ternary-bonsai-2-9b": [8e-8, 1.3e-7, null, 4e-8, null], "moondream3-preview": [3e-7, 0.0000025, null, null, null], "moondream3.1-9b-a2b": [3e-7, 0.0000025, null, null, null], "pareto-26.10": [8e-7, 0.0000032, null, 3e-8, null], "pareto-26.9": [0.0000025, 0.0000075, null, 2.5e-7, null], "lfm-2.5-24b-a2b": [5e-8, 7e-7, null, 2.5e-8, null], "gemini-4-argon:batch": [0.000001, 0.000005, 1.875e-7, 5e-8, null], "claude-haiku-5.5:batch": [5e-8, 2.5e-7, 6.25e-8, 5e-9, null], "grok-4.7:batch": [0.0000016, 0.0000048, null, 4e-7, null], "qwen3.8-27b:batch": [1.6e-7, 0.000002, null, 4e-8, null], "grok-4.6:batch": [0.0000016, 0.0000048, null, 4e-7, null], "lfm-2.5-2.6b": [3.5e-7, 5e-7, null, 4e-8, null], "muse-glimmer-30b:batch": [2.4e-7, 9.6e-7, null, 3.2e-8, null], "ling-3.0-tiny": [1.5e-8, 4.5e-8, null, 3e-9, null], "deepseek-v4-flash-0731:batch": [4.8e-8, 1.44e-7, null, 1.2e-8, null], "inkling-small:batch": [3.6e-7, 9.6e-7, null, 8e-8, null], "qwen3.7-plus:batch": [2.3e-7, 9.2e-7, null, null, null], "minimax-m3:batch": [2.24e-7, 8.8e-7, null, 4.48e-8, null], "qwen2-5-14b-instruct": [3.5e-7, 0.0000014, null, null, null], "qwen2-5-32b-instruct": [7e-7, 0.0000028, null, null, null], "qwen2-5-72b-instruct": [0.0000014, 0.0000056, null, null, null], "qwen2-5-7b-instruct": [1.75e-7, 7e-7, null, null, null], "qwen2-5-vl-72b-instruct": [0.0000028, 0.000008400000000000001, null, null, null], "qwen2-5-vl-7b-instruct": [3.5e-7, 0.0000010500000000000001, null, null, null], "qwen3-asr-flash": [3.5e-8, 3.5e-8, null, null, null], "qwen2-5-coder-32b-instruct": [2.8699999999999996e-7, 8.61e-7, null, null, null], "qwen2-5-coder-7b-instruct": [1.44e-7, 2.8699999999999996e-7, null, null, null], "qwen2-5-math-72b-instruct": [5.739999999999999e-7, 0.0000017210000000000001, null, null, null], "qwen2-5-math-7b-instruct": [1.44e-7, 2.8699999999999996e-7, null, null, null], "devstral-medium-2507": [4.0000000000000003e-7, 0.000002, null, null, null], "devstral-small-2507": [1.0000000000000001e-7, 3e-7, null, null, null], "open-mistral-7b": [2.5e-7, 2.5e-7, null, null, null], "open-mixtral-8x22b": [0.000002, 0.000006, null, null, null], "open-mixtral-8x7b": [7e-7, 7e-7, null, null, null], "ling-3.0-flash-sante": [4.2e-8, 1.232e-7, null, 8.4e-9, null], "palm/chat-bison": [1.25e-7, 1.25e-7, null, null, null, null], "chat-bison": [1.25e-7, 1.25e-7, null, null, null, null], "palm/chat-bison-001": [1.25e-7, 1.25e-7, null, null, null, null], "chat-bison-001": [1.25e-7, 1.25e-7, null, null, null, null], "palm/text-bison": [1.25e-7, 1.25e-7, null, null, null, null], "text-bison": [1.25e-7, 1.25e-7, null, null, null, null], "palm/text-bison-001": [1.25e-7, 1.25e-7, null, null, null, null], "text-bison-001": [1.25e-7, 1.25e-7, null, null, null, null], "palm/text-bison-safety-off": [1.25e-7, 1.25e-7, null, null, null, null], "text-bison-safety-off": [1.25e-7, 1.25e-7, null, null, null, null], "palm/text-bison-safety-recitation-off": [1.25e-7, 1.25e-7, null, null, null, null], "text-bison-safety-recitation-off": [1.25e-7, 1.25e-7, null, null, null, null], "together_ai/baai/bge-base-en-v1.5": [8e-9, 0, null, null, null, null], "baai/bge-base-en-v1.5": [8e-9, 0, null, null, null, null], "fireworks_ai/accounts/fireworks/models/": [1e-7, 0, null, null, null, null], "accounts/fireworks/models/": [1e-7, 0, null, null, null, null], "claude-sonnet-5.5:batch": [0.000001, 0.000005, 0.00000125, 1e-7, null], "mistral/codestral-embed": [1.5e-7, 0, null, null, null, null], "mistral/mistral-embed": [1e-7, 0, null, null, null, null], "azure_ai/muse-spark-1.3": [0.00000125, 0.00000425, null, 1.5e-7, null, null], "amazon.nova-sonic-v1:0": [6e-8, 2.4e-7, null, null, null, null], "anthropic.claude-3-haiku-20240307-v1:0": [2.5e-7, 0.00000125, 3.125e-7, 2.5e-8, null, null], "anthropic.claude-3-sonnet-20240229-v1:0": [0.000003, 0.000015, 0.00000375, 3e-7, null, null], "apac.anthropic.claude-3-5-sonnet-20240620-v1:0": [0.000003, 0.000015, 0.00000375, 3e-7, null, null], "apac.anthropic.claude-3-5-sonnet-20241022-v2:0": [0.000003, 0.000015, 0.00000375, 3e-7, null, null], "apac.anthropic.claude-3-haiku-20240307-v1:0": [2.5e-7, 0.00000125, 3.125e-7, 2.5e-8, null, null], "apac.anthropic.claude-3-sonnet-20240229-v1:0": [0.000003, 0.000015, 0.00000375, 3e-7, null, null], "chatgpt-4o-latest": [0.000005, 0.000015, null, null, null, null], "codex-mini-latest": [0.0000015, 0.000006, null, 3.75e-7, null, null], "cohere.command-r-plus-v1:0": [0.000003, 0.000015, null, null, null, null], "cohere.command-r-v1:0": [5e-7, 0.0000015, null, null, null, null], "command": [0.000001, 0.000002, null, null, null, null], "command-light": [3e-7, 6e-7, null, null, null, null], "command-r": [1.5e-7, 6e-7, null, null, null, null], "embed-english-light-v2.0": [1e-7, 0, null, null, null, null], "embed-english-v2.0": [1e-7, 0, null, null, null, null], "embed-multilingual-v2.0": [1e-7, 0, null, null, null, null], "eu.anthropic.claude-3-haiku-20240307-v1:0": [2.5e-7, 0.00000125, 3.125e-7, 2.5e-8, null, null], "eu.anthropic.claude-3-sonnet-20240229-v1:0": [0.000003, 0.000015, 0.00000375, 3e-7, null, null], "gemini-2.0-flash-001": [1.5e-7, 6e-7, null, 3.75e-8, null, null], "gemini-2.0-flash-lite-001": [7.5e-8, 3e-7, null, 1.875e-8, null, null], "gemini-2.5-flash-lite-preview-06-17": [1e-7, 4e-7, null, 1e-8, null, null], "gpt-4-0314": [0.00003, 0.00006, null, null, null, null], "gpt-4-turbo-preview": [0.00001, 0.00003, null, null, null, null], "gpt-4o-audio-preview": [0.0000025, 0.00001, null, null, null, null], "gpt-4o-mini-audio-preview": [1.5e-7, 6e-7, null, null, null, null], "gpt-4o-mini-realtime-preview": [6e-7, 0.0000024, null, 3e-7, null, null], "gpt-4o-realtime-preview": [0.000005, 0.00002, null, 0.0000025, null, null], "gpt-4o-realtime-preview-2025-06-03": [0.000005, 0.00002, null, 0.0000025, null, null], "us.amazon.nova-premier-v1:0": [0.0000025, 0.0000125, null, 6.25e-7, null, null], "us.anthropic.claude-3-haiku-20240307-v1:0": [2.5e-7, 0.00000125, 3.125e-7, 2.5e-8, null, null], "us.anthropic.claude-3-sonnet-20240229-v1:0": [0.000003, 0.000015, 0.00000375, 3e-7, null, null], "us-gov.anthropic.claude-3-haiku-20240307-v1:0": [3e-7, 0.0000015, 3.75e-7, 3e-8, null, null], "azure_ai/claude-opus-4-1": [0.000015, 0.000075, 0.00001875, 0.0000015, null, null], "azure/eu/o1-preview-2024-09-12": [0.0000165, 0.000066, null, 0.00000825, null, null], "eu/o1-preview-2024-09-12": [0.0000165, 0.000066, null, 0.00000825, null, null], "azure/global/gpt-5.1-chat": [0.00000125, 0.00001, null, 1.25e-7, null, null], "global/gpt-5.1-chat": [0.00000125, 0.00001, null, 1.25e-7, null, null], "azure/gpt-3.5-turbo-0125": [5e-7, 0.0000015, null, null, null, null], "azure/gpt-35-turbo-0125": [5e-7, 0.0000015, null, null, null, null], "gpt-35-turbo-0125": [5e-7, 0.0000015, null, null, null, null], "azure/gpt-35-turbo-1106": [0.000001, 0.000002, null, null, null, null], "gpt-35-turbo-1106": [0.000001, 0.000002, null, null, null, null], "azure/gpt-5.1-chat-2025-11-13": [0.00000125, 0.00001, null, 1.25e-7, null, null], "gpt-5.1-chat-2025-11-13": [0.00000125, 0.00001, null, 1.25e-7, null, null], "azure/gpt-5-chat-latest": [0.00000125, 0.00001, null, 1.25e-7, null, null], "azure/gpt-5.2-chat-2025-12-11": [0.00000175, 0.000014, null, 1.75e-7, null, null], "gpt-5.2-chat-2025-12-11": [0.00000175, 0.000014, null, 1.75e-7, null, null], "azure/o1-preview": [0.000015, 0.00006, null, 0.0000075, null, null], "o1-preview": [0.000015, 0.00006, null, 0.0000075, null, null], "azure/o1-preview-2024-09-12": [0.000015, 0.00006, null, 0.0000075, null, null], "o1-preview-2024-09-12": [0.000015, 0.00006, null, 0.0000075, null, null], "azure/us/o1-preview-2024-09-12": [0.0000165, 0.000066, null, 0.00000825, null, null], "us/o1-preview-2024-09-12": [0.0000165, 0.000066, null, 0.00000825, null, null], "azure_ai/Llama-3.2-11B-Vision-Instruct": [3.7e-7, 3.7e-7, null, null, null, null], "Llama-3.2-11B-Vision-Instruct": [3.7e-7, 3.7e-7, null, null, null, null], "azure_ai/Llama-3.2-90B-Vision-Instruct": [0.00000204, 0.00000204, null, null, null, null], "Llama-3.2-90B-Vision-Instruct": [0.00000204, 0.00000204, null, null, null, null], "azure_ai/Meta-Llama-3.1-405B-Instruct": [0.00000533, 0.000016, null, null, null, null], "Meta-Llama-3.1-405B-Instruct": [0.00000533, 0.000016, null, null, null, null], "azure_ai/Meta-Llama-3.1-8B-Instruct": [3e-7, 6.1e-7, null, null, null, null], "Meta-Llama-3.1-8B-Instruct": [3e-7, 6.1e-7, null, null, null, null], "azure_ai/global/grok-3": [0.000003, 0.000015, null, null, null, null], "global/grok-3": [0.000003, 0.000015, null, null, null, null], "azure_ai/global/grok-3-mini": [2.5e-7, 0.00000127, null, null, null, null], "global/grok-3-mini": [2.5e-7, 0.00000127, null, null, null, null], "cerebras/zai-glm-4.6": [0.00000225, 0.00000275, null, null, null, null], "zai-glm-4.6": [0.00000225, 0.00000275, null, null, null, null], "cerebras/zai-glm-4.7": [0.00000225, 0.00000275, null, null, null, null], "zai-glm-4.7": [0.00000225, 0.00000275, null, null, null, null], "databricks/databricks-claude-3-7-sonnet": [0.0000029999900000000002, 0.000015000020000000002, 0.00000374997, 3.0002e-7, null, null], "databricks-claude-3-7-sonnet": [0.0000029999900000000002, 0.000015000020000000002, 0.00000374997, 3.0002e-7, null, null], "databricks/databricks-gpt-5-1-codex-max": [0.00000124999, 0.000009999990000000002, 0.00000124999, 1.2502e-7, null, null], "databricks-gpt-5-1-codex-max": [0.00000124999, 0.000009999990000000002, 0.00000124999, 1.2502e-7, null, null], "databricks/databricks-gpt-5-1-codex-mini": [2.4997e-7, 0.00000199997, 2.4997e-7, 2.499e-8, null, null], "databricks-gpt-5-1-codex-mini": [2.4997e-7, 0.00000199997, 2.4997e-7, 2.499e-8, null, null], "databricks/databricks-gpt-5-2-codex": [0.00000175, 0.000014, 0.00000175, 1.75e-7, null, null], "databricks-gpt-5-2-codex": [0.00000175, 0.000014, 0.00000175, 1.75e-7, null, null], "databricks/databricks-llama-2-70b-chat": [5.0001e-7, 0.0000015000300000000002, 5.0001e-7, 5.0001e-7, null, null], "databricks-llama-2-70b-chat": [5.0001e-7, 0.0000015000300000000002, 5.0001e-7, 5.0001e-7, null, null], "databricks/databricks-meta-llama-3-1-405b-instruct": [0.00000500003, 0.000015000020000000002, 0.00000500003, 0.00000500003, null, null], "databricks-meta-llama-3-1-405b-instruct": [0.00000500003, 0.000015000020000000002, 0.00000500003, 0.00000500003, null, null], "databricks/databricks-meta-llama-3-70b-instruct": [0.00000100002, 0.0000029999900000000002, 0.00000100002, 0.00000100002, null, null], "databricks-meta-llama-3-70b-instruct": [0.00000100002, 0.0000029999900000000002, 0.00000100002, 0.00000100002, null, null], "databricks/databricks-mixtral-8x7b-instruct": [5.0001e-7, 0.00000100002, 5.0001e-7, 5.0001e-7, null, null], "databricks-mixtral-8x7b-instruct": [5.0001e-7, 0.00000100002, 5.0001e-7, 5.0001e-7, null, null], "databricks/databricks-mpt-30b-instruct": [0.00000100002, 0.00000100002, 0.00000100002, 0.00000100002, null, null], "databricks-mpt-30b-instruct": [0.00000100002, 0.00000100002, 0.00000100002, 0.00000100002, null, null], "databricks/databricks-mpt-7b-instruct": [5.0001e-7, 0, 5.0001e-7, 5.0001e-7, null, null], "databricks-mpt-7b-instruct": [5.0001e-7, 0, 5.0001e-7, 5.0001e-7, null, null], "deepinfra/google/gemini-2.0-flash-001": [1e-7, 4e-7, null, null, null, null], "google/gemini-2.0-flash-001": [1e-7, 4e-7, null, null, null, null], "fireworks_ai/accounts/fireworks/models/minimax-m2p7": [3e-7, 0.0000012, null, 6e-8, null, null], "accounts/fireworks/models/minimax-m2p7": [3e-7, 0.0000012, null, 6e-8, null, null], "fireworks_ai/deepseek-v4-pro": [0.0000012, 0.0000012, null, 6e-7, null, null], "fireworks_ai/minimax-m2p7": [3e-7, 0.0000012, null, 6e-8, null, null], "minimax-m2p7": [3e-7, 0.0000012, null, 6e-8, null, null], "friendliai/LGAI-EXAONE/K-EXAONE-2.0-750B-A37B": [6e-7, 0.0000024, null, 1.2e-7, null, null], "LGAI-EXAONE/K-EXAONE-2.0-750B-A37B": [6e-7, 0.0000024, null, 1.2e-7, null, null], "gemini/gemini-robotics-er-1.5-preview": [3e-7, 0.0000025, null, 0, null, null], "gemini/gemini-robotics-er-1.6-preview": [0.000001, 0.000005, null, null, null, null], "gemini-robotics-er-1.6-preview": [0.000001, 0.000005, null, null, null, null], "gemini/gemini-1.5-flash": [7.5e-8, 0, null, null, null, null], "gemini-1.5-flash": [7.5e-8, 0, null, null, null, null], "gemini/gemini-2.0-flash": [1e-7, 4e-7, null, 2.5e-8, null, null], "gemini/gemini-2.0-flash-001": [1e-7, 4e-7, null, 2.5e-8, null, null], "gemini/gemini-2.0-flash-lite": [7.5e-8, 3e-7, null, 1.875e-8, null, null], "gemini/gemini-2.5-flash-lite-preview-09-2025": [1e-7, 4e-7, null, 1e-8, null, null], "gemini/gemini-2.5-flash-preview-09-2025": [3e-7, 0.0000025, null, 3e-8, null, null], "gemini/gemini-2.5-flash-lite-preview-06-17": [1e-7, 4e-7, null, 1e-8, null, null], "gemini/gemini-3-pro-preview": [0.000002, 0.000012, null, 2e-7, null, { "threshold": 200000, "input": 0.000004, "output": 0.000018, "cacheWrite": null, "cacheRead": 4e-7 }], "groq/llama-3.1-8b-instant": [5e-8, 8e-8, null, null, null, null], "groq/llama-3.3-70b-versatile": [5.9e-7, 7.9e-7, null, null, null, null], "groq/gemma-7b-it": [5e-8, 8e-8, null, null, null, null], "gemma-7b-it": [5e-8, 8e-8, null, null, null, null], "groq/meta-llama/llama-guard-4-12b": [2e-7, 2e-7, null, null, null, null], "groq/meta-llama/llama-4-maverick-17b-128e-instruct": [2e-7, 6e-7, null, null, null, null], "meta-llama/llama-4-maverick-17b-128e-instruct": [2e-7, 6e-7, null, null, null, null], "groq/meta-llama/llama-4-scout-17b-16e-instruct": [1.1e-7, 3.4e-7, null, null, null, null], "groq/moonshotai/kimi-k2-instruct-0905": [0.000001, 0.000003, null, 5e-7, null, null], "moonshotai/kimi-k2-instruct-0905": [0.000001, 0.000003, null, 5e-7, null, null], "groq/qwen/qwen3.6-27b": [6e-7, 0.000003, null, null, null, null], "groq/qwen/qwen3-32b": [2.9e-7, 5.9e-7, null, null, null, null], "mistral/codestral-2405": [0.000001, 0.000003, null, null, null, null], "mistral/devstral-medium-2507": [4e-7, 0.000002, null, null, null, null], "mistral/devstral-small-2505": [1e-7, 3e-7, null, null, null, null], "devstral-small-2505": [1e-7, 3e-7, null, null, null, null], "mistral/devstral-small-2507": [1e-7, 3e-7, null, null, null, null], "mistral/labs-devstral-small-2512": [1e-7, 3e-7, null, null, null, null], "labs-devstral-small-2512": [1e-7, 3e-7, null, null, null, null], "mistral/devstral-2512": [4e-7, 0.000002, null, null, null, null], "devstral-2512": [4e-7, 0.000002, null, null, null, null], "mistral/magistral-medium-2506": [0.000002, 0.000005, null, null, null, null], "magistral-medium-2506": [0.000002, 0.000005, null, null, null, null], "mistral/magistral-medium-2509": [0.000002, 0.000005, null, null, null, null], "magistral-medium-2509": [0.000002, 0.000005, null, null, null, null], "mistral/magistral-medium-1-2-2509": [0.000002, 0.000005, null, null, null, null], "magistral-medium-1-2-2509": [0.000002, 0.000005, null, null, null, null], "mistral/magistral-small-2506": [5e-7, 0.0000015, null, null, null, null], "magistral-small-2506": [5e-7, 0.0000015, null, null, null, null], "mistral/magistral-small-1-2-2509": [5e-7, 0.0000015, null, null, null, null], "magistral-small-1-2-2509": [5e-7, 0.0000015, null, null, null, null], "mistral/mistral-large-2402": [0.000004, 0.000012, null, null, null, null], "mistral/mistral-large-2407": [0.000003, 0.000009, null, null, null, null], "mistral/mistral-large-2411": [0.000002, 0.000006, null, null, null, null], "mistral/mistral-medium-2312": [0.0000027, 0.0000081, null, null, null, null], "mistral-medium-2312": [0.0000027, 0.0000081, null, null, null, null], "mistral/mistral-medium-2505": [4e-7, 0.000002, null, null, null, null], "mistral/mistral-medium-2508": [4e-7, 0.000002, null, null, null, null], "mistral/mistral-medium-3-1-2508": [4e-7, 0.000002, null, null, null, null], "mistral-medium-3-1-2508": [4e-7, 0.000002, null, null, null, null], "mistral/mistral-small-3-2-2506": [6e-8, 1.8e-7, null, null, null, null], "mistral-small-3-2-2506": [6e-8, 1.8e-7, null, null, null, null], "mistral/open-codestral-mamba": [2.5e-7, 2.5e-7, null, null, null, null], "open-codestral-mamba": [2.5e-7, 2.5e-7, null, null, null, null], "mistral/open-mistral-7b": [2.5e-7, 2.5e-7, null, null, null, null], "mistral/open-mistral-nemo-2407": [3e-7, 3e-7, null, null, null, null], "open-mistral-nemo-2407": [3e-7, 3e-7, null, null, null, null], "mistral/open-mixtral-8x22b": [0.000002, 0.000006, null, null, null, null], "mistral/open-mixtral-8x7b": [7e-7, 7e-7, null, null, null, null], "mistral/pixtral-12b-2409": [1.5e-7, 1.5e-7, null, null, null, null], "pixtral-12b-2409": [1.5e-7, 1.5e-7, null, null, null, null], "mistral/pixtral-large-2411": [0.000002, 0.000006, null, null, null, null], "pixtral-large-2411": [0.000002, 0.000006, null, null, null, null], "moonshot/kimi-k2-0711-preview": [6e-7, 0.0000025, null, 1.5e-7, null, null], "kimi-k2-0711-preview": [6e-7, 0.0000025, null, 1.5e-7, null, null], "moonshot/kimi-k2-0905-preview": [6e-7, 0.0000025, null, 1.5e-7, null, null], "kimi-k2-0905-preview": [6e-7, 0.0000025, null, 1.5e-7, null, null], "moonshot/kimi-k2-turbo-preview": [0.00000115, 0.000008, null, 1.5e-7, null, null], "kimi-k2-turbo-preview": [0.00000115, 0.000008, null, 1.5e-7, null, null], "moonshot/kimi-latest": [0.000002, 0.000005, null, 1.5e-7, null, null], "kimi-latest": [0.000002, 0.000005, null, 1.5e-7, null, null], "moonshot/kimi-latest-128k": [0.000002, 0.000005, null, 1.5e-7, null, null], "kimi-latest-128k": [0.000002, 0.000005, null, 1.5e-7, null, null], "moonshot/kimi-latest-32k": [0.000001, 0.000003, null, 1.5e-7, null, null], "kimi-latest-32k": [0.000001, 0.000003, null, 1.5e-7, null, null], "moonshot/kimi-latest-8k": [2e-7, 0.000002, null, 1.5e-7, null, null], "kimi-latest-8k": [2e-7, 0.000002, null, 1.5e-7, null, null], "moonshot/kimi-thinking-preview": [6e-7, 0.0000025, null, 1.5e-7, null, null], "kimi-thinking-preview": [6e-7, 0.0000025, null, 1.5e-7, null, null], "moonshot/kimi-k2-thinking": [6e-7, 0.0000025, null, 1.5e-7, null, null], "moonshot/kimi-k2-thinking-turbo": [0.00000115, 0.000008, null, 1.5e-7, null, null], "kimi-k2-thinking-turbo": [0.00000115, 0.000008, null, 1.5e-7, null, null], "moonshot/moonshot-v1-128k-0430": [0.000002, 0.000005, null, null, null, null], "moonshot-v1-128k-0430": [0.000002, 0.000005, null, null, null, null], "moonshot/moonshot-v1-32k-0430": [0.000001, 0.000003, null, null, null, null], "moonshot-v1-32k-0430": [0.000001, 0.000003, null, null, null, null], "moonshot/moonshot-v1-8k-0430": [2e-7, 0.000002, null, null, null, null], "moonshot-v1-8k-0430": [2e-7, 0.000002, null, null, null, null], "openrouter/anthropic/claude-opus-4": [0.000015, 0.000075, 0.00001875, 0.0000015, null, null], "openrouter/google/gemini-2.0-flash-001": [1e-7, 4e-7, null, null, null, null], "sambanova/DeepSeek-R1-Distill-Llama-70B": [7e-7, 0.0000014, null, null, null, null], "sambanova/DeepSeek-V3-0324": [0.000003, 0.0000045, null, null, null, null], "DeepSeek-V3-0324": [0.000003, 0.0000045, null, null, null, null], "sambanova/Llama-4-Scout-17B-16E-Instruct": [4e-7, 7e-7, null, null, null, null], "sambanova/Meta-Llama-3.1-405B-Instruct": [0.000005, 0.00001, null, null, null, null], "sambanova/Meta-Llama-3.1-8B-Instruct": [1e-7, 2e-7, null, null, null, null], "sambanova/Meta-Llama-3.2-1B-Instruct": [4e-8, 8e-8, null, null, null, null], "Meta-Llama-3.2-1B-Instruct": [4e-8, 8e-8, null, null, null, null], "sambanova/Meta-Llama-3.2-3B-Instruct": [8e-8, 1.6e-7, null, null, null, null], "Meta-Llama-3.2-3B-Instruct": [8e-8, 1.6e-7, null, null, null, null], "sambanova/Meta-Llama-Guard-3-8B": [3e-7, 3e-7, null, null, null, null], "Meta-Llama-Guard-3-8B": [3e-7, 3e-7, null, null, null, null], "sambanova/QwQ-32B": [5e-7, 0.000001, null, null, null, null], "QwQ-32B": [5e-7, 0.000001, null, null, null, null], "sambanova/Qwen2-Audio-7B-Instruct": [5e-7, 0.0001, null, null, null, null], "Qwen2-Audio-7B-Instruct": [5e-7, 0.0001, null, null, null, null], "sambanova/Qwen3-32B": [4e-7, 8e-7, null, null, null, null], "together_ai/Qwen/Qwen3-235B-A22B-Instruct-2507-tput": [2e-7, 0.000006, null, null, null, null], "Qwen/Qwen3-235B-A22B-Instruct-2507-tput": [2e-7, 0.000006, null, null, null, null], "together_ai/Qwen/Qwen3-235B-A22B-Thinking-2507": [6.5e-7, 0.000003, null, null, null, null], "together_ai/Qwen/Qwen3-235B-A22B-fp8-tput": [2e-7, 6e-7, null, null, null, null], "Qwen/Qwen3-235B-A22B-fp8-tput": [2e-7, 6e-7, null, null, null, null], "together_ai/deepseek-ai/DeepSeek-R1": [0.000003, 0.000007, null, null, null, null], "together_ai/deepseek-ai/DeepSeek-R1-0528-tput": [5.5e-7, 0.00000219, null, null, null, null], "deepseek-ai/DeepSeek-R1-0528-tput": [5.5e-7, 0.00000219, null, null, null, null], "together_ai/meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8": [2.7e-7, 8.5e-7, null, null, null, null], "together_ai/meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo": [0.0000035, 0.0000035, null, null, null, null], "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo": [0.0000035, 0.0000035, null, null, null, null], "together_ai/moonshotai/Kimi-K2.5": [5e-7, 0.0000028, null, null, null, null], "together_ai/moonshotai/Kimi-K2-Instruct-0905": [0.000001, 0.000003, null, null, null, null], "together_ai/deepseek-ai/DeepSeek-V4-Pro": [0.00000174, 0.00000348, null, 2e-7, null, null], "together_ai/google/gemma-3n-E4B-it": [6e-8, 1.2e-7, null, null, null, null], "google/gemma-3n-E4B-it": [6e-8, 1.2e-7, null, null, null, null], "together_ai/intfloat/multilingual-e5-large-instruct": [2e-8, 2e-8, null, null, null, null], "intfloat/multilingual-e5-large-instruct": [2e-8, 2e-8, null, null, null, null], "together_ai/meta-llama/Llama-Guard-4-12B": [2e-7, 2e-7, null, null, null, null], "together_ai/pearl-ai/gemma-4-31b-it": [2.8e-7, 8.6e-7, null, null, null, null], "pearl-ai/gemma-4-31b-it": [2.8e-7, 8.6e-7, null, null, null, null], "together_ai/thinkingmachines/Inkling-Small": [5e-7, 0.0000012, null, 1e-7, null, null], "vercel_ai_gateway/google/gemini-2.0-flash": [1.5e-7, 6e-7, null, null, null, null], "google/gemini-2.0-flash": [1.5e-7, 6e-7, null, null, null, null], "vercel_ai_gateway/google/gemini-2.0-flash-lite": [7.5e-8, 3e-7, null, null, null, null], "google/gemini-2.0-flash-lite": [7.5e-8, 3e-7, null, null, null, null], "vertex_ai/claude-opus-4": [0.000015, 0.000075, 0.00001875, 0.0000015, null, null], "vertex_ai/claude-opus-4-1": [0.000015, 0.000075, 0.00001875, 0.0000015, null, null], "vertex_ai/claude-sonnet-4": [0.000003, 0.000015, 0.00000375, 3e-7, null, { "threshold": 200000, "input": 0.000006, "output": 0.0000225, "cacheWrite": 0.0000075, "cacheRead": 6e-7 }], "wandb/zai-org/GLM-4.5": [0.055, 0.2, null, null, null, null], "wandb/Qwen/Qwen3-235B-A22B-Instruct-2507": [1e-7, 1e-7, null, null, null, null], "wandb/Qwen/Qwen3-Coder-480B-A35B-Instruct": [0.000001, 0.0000015, null, null, null, null], "wandb/Qwen/Qwen3-235B-A22B-Thinking-2507": [1e-7, 1e-7, null, null, null, null], "wandb/moonshotai/Kimi-K2-Instruct": [6e-7, 0.0000025, null, null, null, null], "wandb/MiniMaxAI/MiniMax-M2.5": [3e-7, 0.0000012, null, null, null, null], "wandb/deepseek-ai/DeepSeek-R1-0528": [0.00000135, 0.0000054, null, null, null, null], "wandb/deepseek-ai/DeepSeek-V3-0324": [0.00000114, 0.00000275, null, null, null, null], "wandb/meta-llama/Llama-4-Scout-17B-16E-Instruct": [1.7e-7, 6.6e-7, null, null, null, null], "wandb/microsoft/Phi-4-mini-instruct": [0.008, 0.035, null, null, null, null], "microsoft/Phi-4-mini-instruct": [0.008, 0.035, null, null, null, null], "xai/grok-3-beta": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-beta": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-3-fast-beta": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-fast-beta": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-3-fast-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-fast-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-3-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-3-mini-beta": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-mini-beta": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-mini-fast": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-3-mini-fast-beta": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-mini-fast-beta": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-3-mini-fast-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-mini-fast-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-3-mini-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-3-mini-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-fast-reasoning": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-fast-non-reasoning": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-0709": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-4-0709": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-4-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-1-fast": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-4-1-fast": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-1-fast-reasoning": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-1-fast-reasoning-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-4-1-fast-reasoning-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-1-fast-non-reasoning": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "xai/grok-4-1-fast-non-reasoning-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "grok-4-1-fast-non-reasoning-latest": [0.00000125, 0.0000025, null, 2e-7, null, { "threshold": 200000, "input": 0.0000025, "output": 0.000005, "cacheWrite": null, "cacheRead": 4e-7 }], "scaleway/google/gemma-3-27b-it": [2.5e-7, 5e-7, null, null, null, null], "scaleway/hcompany/holo2-30b-a3b": [3e-7, 7e-7, null, null, null, null], "hcompany/holo2-30b-a3b": [3e-7, 7e-7, null, null, null, null], "scaleway/mistralai/devstral-2-123b-instruct-2512": [4e-7, 0.000002, null, null, null, null], "mistralai/devstral-2-123b-instruct-2512": [4e-7, 0.000002, null, null, null, null], "scaleway/mistralai/voxtral-small-24b-2507": [1.5e-7, 3.5e-7, null, null, null, null], "gemini/gemini-2.0-flash-lite-001": [7.5e-8, 3e-7, null, 1.875e-8, null, null], "vertex_ai/gemini-3.1-flash-live-preview": [7.5e-7, 0.0000045, null, null, null, null], "vertex_ai/gemini-robotics-er-2": [0.000001, 0.000005, null, 1e-7, null, null], "gemini-robotics-er-2": [0.000001, 0.000005, null, 1e-7, null, null], "openrouter/deepseek/deepseek-v4-flash-0731:batch": [1.1e-7, 3.3e-7, null, 3.5e-9, null, null], "deepseek/deepseek-v4-flash-0731:batch": [1.1e-7, 3.3e-7, null, 3.5e-9, null, null], "openrouter/deepseek/deepseek-v4-flash-vision-exp:batch": [1.1e-7, 3.3e-7, null, 3.5e-9, null, null], "deepseek/deepseek-v4-flash-vision-exp:batch": [1.1e-7, 3.3e-7, null, 3.5e-9, null, null], "openrouter/deepseek/deepseek-v4-pro-0813:batch": [6.6e-7, 0.00000198, null, 2.2e-8, null, null], "deepseek/deepseek-v4-pro-0813:batch": [6.6e-7, 0.00000198, null, 2.2e-8, null, null], "openrouter/kwaipilot/kat-coder-pro-v2": [3e-7, 0.0000012, null, 6e-8, null, null], "kwaipilot/kat-coder-pro-v2": [3e-7, 0.0000012, null, 6e-8, null, null], "openrouter/meta/muse-glimmer-30b:batch": [1.75e-7, 7.5e-7, null, 2e-8, null, null], "meta/muse-glimmer-30b:batch": [1.75e-7, 7.5e-7, null, 2e-8, null, null], "openrouter/minimax/minimax-m3:batch": [3e-7, 0.0000012, null, 6e-8, null, null], "minimax/minimax-m3:batch": [3e-7, 0.0000012, null, 6e-8, null, null], "openrouter/qwen/qwen3.5-9b:batch": [1.7e-7, 2.5e-7, null, null, null, null], "qwen/qwen3.5-9b:batch": [1.7e-7, 2.5e-7, null, null, null, null], "openrouter/qwen/qwen3.8-2.4t-a95b:batch": [0.000002, 0.000006, null, 2.5e-7, null, null], "qwen/qwen3.8-2.4t-a95b:batch": [0.000002, 0.000006, null, 2.5e-7, null, null], "openrouter/thinkingmachines/inkling:batch": [0.000001, 0.00000405, null, 1.7e-7, null, null], "thinkingmachines/inkling:batch": [0.000001, 0.00000405, null, 1.7e-7, null, null], "openrouter/z-ai/glm-5.2:batch": [7e-7, 0.0000022, null, 7e-8, null, null], "z-ai/glm-5.2:batch": [7e-7, 0.0000022, null, 7e-8, null, null], "llama-3.3-70b-instruct-maas": [7.2e-7, 7.2e-7, null, null, null], "glm-5.2-maas": [0.0000014, 0.0000044, null, 1.4e-7, null], "ternary-bonsai-2-27b": [7.5e-8, 5e-7, null, null, null], "twelvelabs.marengo-embed-2-7-v1:0": [0.00007, 0, null, null, null], "us.twelvelabs.marengo-embed-2-7-v1:0": [0.00007, 0, null, null, null], "eu.twelvelabs.marengo-embed-2-7-v1:0": [0.00007, 0, null, null, null], "gpt-image-2-2026-04-21": [0.000005, 0.00001, null, 0.00000125, null], "azure/gpt-image-2": [0.000005, 0.00001, null, 0.00000125, null], "azure/gpt-image-2-2026-04-21": [0.000005, 0.00001, null, 0.00000125, null], "friendliai/meta-llama-3.1-70b-instruct": [6e-7, 6e-7, null, null, null], "meta-llama-3.1-70b-instruct": [6e-7, 6e-7, null, null, null], "friendliai/meta-llama-3.1-8b-instruct": [1e-7, 1e-7, null, null, null], "meta-llama-3.1-8b-instruct": [1e-7, 1e-7, null, null, null], "gmi/google/gemini-3-pro-preview": [0.000002, 0.000012, null, null, null], "qwen3-coder-flash": [3e-7, 0.0000015, null, null, null], "qwen3.5-plus": [4.0000000000000003e-7, 0.0000024, null, null, null], "qwen3.6-flash": [1.875e-7, 0.000001125, 2.34375e-7, null, null], "gemini-3.8-flash:batch": [3.75e-7, 0.000001875, 4.16666666666667e-8, 3.75e-8, null], "claude-fable-5.1:batch": [0.000005, 0.000025, 0.00000625, 1.25e-7, null], "mercury-2.5-preview": [4e-8, 1.5e-7, null, 4e-9, null], "granite-4.2-8b": [1e-7, 1.5e-7, null, 5e-8, null], "ling-3.0-flash-fin": [6e-8, 1.8e-7, null, 1.2e-8, null], "glm-flash-latest": [7.125e-8, 2.375e-7, null, 1.425e-8, null], "glm-5.3-flash:batch": [1.5e-7, 5e-7, null, 3e-8, null], "hy-mt2-1.8b": [4.4e-8, 1.77e-7, null, null, null], "hy-mt2-30b-a3b": [7.4e-8, 2.95e-7, null, null, null], "glm-latest": [0.000001148, 0.000003608, null, 1.886e-7, null], "hy-mt2-7b": [7.4e-8, 2.95e-7, null, null, null], "gemini-3.7-flash:batch": [3.75e-7, 0.000001875, 4.16666666666667e-8, 3.75e-8, null], "qwen3.8-2.4t-a95b:batch": [0.000002, 0.000006, null, 2.5e-7, null], "deepseek-v4-pro-0813:batch": [0.00000132, 0.00000396, null, 1.3e-7, null], "sakana-namazu": [9.5e-7, 0.000004, null, 1.5e-7, null], "solar-pro4": [3e-8, 1.2e-7, null, 6e-9, null], "deepseek-v4-flash-latest": [5e-8, 1.6e-7, null, 1.3e-8, null], "claude-opus-5:batch": [0.0000025, 0.0000125, 0.000003125, 2.5e-7, null], "laguna-s-2.1": [9e-8, 1.8e-7, null, 9e-9, null], "gemini-3.6-flash:batch": [3.75e-7, 0.000001875, 4.16666666666667e-8, 3.75e-8, null], "gemini-3.5-flash-lite:batch": [1.5e-7, 0.00000125, null, 1.5e-8, null], "inkling:batch": [0.000001, 0.00000405, null, 1.7e-7, null], "kimi-k3:batch": [0.000003, 0.000015, null, 3e-7, null], "kat-coder-pro-v2.5": [7.4e-7, 0.00000296, null, 1.5e-7, null], "gpt-5.6-luna-pro:batch": [1e-7, 6e-7, null, 1e-8, null], "gpt-5.6-luna:batch": [1e-7, 6e-7, null, 1e-8, null], "gpt-5.6-terra-pro:batch": [0.000001, 0.000006, null, 1e-7, null], "gpt-5.6-terra:batch": [0.000001, 0.000006, null, 1e-7, null], "gpt-5.6-sol-pro:batch": [0.000001, 0.000005, 0.00000125, 1e-7, null], "gpt-5.6-sol:batch": [0.000001, 0.000005, 0.00000125, 1e-7, null], "grok-latest": [0.000002, 0.000006, null, 5e-7, null], "aion-3.0-mini": [7e-7, 0.0000014, null, 1.8e-7, null], "aion-3.0": [0.000003, 0.000006, null, 7.5e-7, null], "laguna-xs-2.1": [6e-8, 1.2e-7, null, 3e-8, null], "claude-sonnet-5:batch": [0.000001, 0.000005, 0.00000125, 1e-7, null], "nex-n2-mini": [2.5e-8, 1e-7, null, 2.5e-9, null], "fugu-ultra": [0.000005, 0.00003, null, 5e-7, null], "claude-fable-latest": [0.00001, 0.00005, 0.0000125, 2.5e-7, null], "claude-fable-5:batch": [0.000005, 0.000025, 0.00000625, 5e-7, null], "nex-n2-pro": [2.5e-7, 0.000001, null, 2.5e-8, null], "claude-opus-4.8:batch": [0.0000025, 0.0000125, 0.000003125, 2.5e-7, null], "gemini-3.5-flash:batch": [7.5e-7, 0.0000045, null, 7.5e-8, null], "perceptron-mk1": [1.5e-7, 0.0000015, null, null, null], "gemini-3.1-flash-lite:batch": [1.25e-7, 7.5e-7, null, 1.25e-8, null], "mistral-medium-3-5:batch": [7.5e-7, 0.00000375, null, null, null], "claude-haiku-latest": [0.000001, 0.000005, 0.00000125, 1e-7, null], "gpt-mini-latest": [7.5e-7, 0.0000045, null, 7.5e-8, null], "claude-sonnet-latest": [0.000002, 0.00001, 0.0000025, 2e-7, null], "gpt-latest": [0.000002, 0.00001, 0.0000025, 2e-7, null], "gpt-5.5-pro:batch": [0.000015, 0.00009, null, null, null], "gpt-5.5:batch": [0.0000025, 0.000015, null, 2.5e-7, null], "hy3-preview": [1.8e-7, 6e-7, null, 6e-8, null], "gpt-5.4-image-2": [0.000008, 0.000015, null, 0.000002, null], "claude-opus-latest": [0.000005, 0.000025, 0.00000625, 5e-7, null], "claude-opus-4.7:batch": [0.0000025, 0.0000125, 0.000003125, 2.5e-7, null], "gemma-4-31b-it:batch": [3.9e-7, 9.7e-7, null, null, null], "trinity-large-thinking": [2.5e-7, 8e-7, null, 6e-8, null], "kat-coder-pro-v2": [3e-7, 0.0000012, null, 6e-8, null], "reka-edge": [1e-7, 1e-7, null, null, null], "gpt-5.4-nano:batch": [1e-7, 6.25e-7, null, 1e-8, null], "gpt-5.4-mini:batch": [3.75e-7, 0.00000225, null, 3.75e-8, null], "nemotron-3-super-120b-a12b": [8.5e-8, 4e-7, null, null, null], "seed-2.0-lite": [2.5e-7, 0.000002, null, null, null], "qwen3.5-9b:batch": [1.7e-7, 2.5e-7, null, null, null], "gpt-5.4-pro:batch": [0.000015, 0.00009, null, null, null], "gpt-5.4:batch": [0.00000125, 0.0000075, null, 1.25e-7, null], "aion-2.0": [8e-7, 0.0000016, null, 2e-7, null], "gemini-3.1-pro-preview:batch": [0.000001, 0.000006, null, null, null], "claude-sonnet-4.6:batch": [0.0000015, 0.0000075, 0.000001875, 1.5e-7, null], "claude-opus-4.6:batch": [0.0000025, 0.0000125, 0.000003125, 2.5e-7, null], "step-3.5-flash": [1e-7, 3e-7, null, null, null], "solar-pro-3": [1.5e-7, 6e-7, null, 1.5e-8, null], "minimax-m2-her": [3e-7, 0.0000012, null, 3e-8, null], "palmyra-x5": [6e-7, 0.000006, null, null, null], "seed-1.6-flash": [7.5e-8, 3e-7, null, null, null], "seed-1.6": [2.5e-7, 0.000002, null, null, null], "gemini-3-flash-preview:batch": [2.5e-7, 0.0000015, null, null, null], "gpt-5.2-pro:batch": [0.0000105, 0.000084, null, null, null], "gpt-5.2:batch": [8.75e-7, 0.000007, null, 8.75e-8, null], "relace-search": [0.000001, 0.000003, null, null, null], "nova-2-lite-v1": [3e-7, 0.0000025, null, null, null], "claude-opus-4.5:batch": [0.0000025, 0.0000125, 0.000003125, 2.5e-7, null], "gpt-5.1:batch": [6.25e-7, 0.000005, null, 6.25e-8, null], "sonar-pro-search": [0.000003, 0.000015, null, null, null], "gpt-5-image-mini": [0.0000025, 0.000002, null, 2.5e-7, null], "claude-haiku-4.5:batch": [5e-7, 0.0000025, 6.25e-7, 5e-8, null], "qwen3-vl-8b-thinking": [1.8e-7, 0.0000021, null, null, null], "gpt-5-image": [0.00001, 0.00001, null, 0.00000125, null], "gpt-5-pro:batch": [0.0000075, 0.00006, null, null, null], "claude-sonnet-4.5:batch": [0.0000015, 0.0000075, 0.000001875, 1.5e-7, null], "cydonia-24b-v4.1": [3e-7, 5e-7, null, 1.5e-7, null], "relace-apply-3": [8.5e-7, 0.00000125, null, null, null], "qwen-plus-2025-07-28": [2.6e-7, 7.8e-7, null, null, null], "hermes-4-70b": [1.3e-7, 4e-7, null, null, null], "hermes-4-405b": [0.000001, 0.000003, null, null, null], "mistral-medium-3.1": [4e-7, 0.000002, null, 4e-8, null], "gpt-5:batch": [6.25e-7, 0.000005, null, 6.25e-8, null], "gpt-5-mini:batch": [1.25e-7, 0.000001, null, 1.25e-8, null], "gpt-5-nano:batch": [2.5e-8, 2e-7, null, 2.5e-9, null], "gpt-oss-120b:batch": [1.5e-7, 6e-7, null, null, null], "gpt-oss-20b:batch": [5e-8, 2e-7, null, null, null], "claude-opus-4.1:batch": [0.0000075, 0.0000375, 0.000009375, 7.5e-7, null], "gemini-2.5-flash-lite:batch": [5e-8, 2e-7, null, 1e-8, null], "dolphin-mistral-24b-venice-edition": [2e-7, 9e-7, null, null, null], "hunyuan-a13b-instruct": [1.4e-7, 5.7e-7, null, null, null], "minimax-m1": [5.5e-7, 0.0000022, null, null, null], "gemini-2.5-flash:batch": [1.5e-7, 0.00000125, null, 3e-8, null], "gemini-2.5-pro:batch": [6.25e-7, 0.000005, null, 1.25e-7, null], "gemini-2.5-pro-preview": [0.00000125, 0.00001, 3.75e-7, 1.25e-7, null], "gemini-2.5-pro-preview-05-06": [0.00000125, 0.00001, 3.75e-7, 1.25e-7, null], "o4-mini-high": [0.0000011, 0.0000044, null, 2.75e-7, null], "o3:batch": [0.000001, 0.000004, null, 2.5e-7, null], "o4-mini:batch": [5.5e-7, 0.0000022, null, 1.375e-7, null], "gpt-4.1:batch": [0.000001, 0.000004, null, 2.5e-7, null], "gpt-4.1-mini:batch": [2e-7, 8e-7, null, 5e-8, null], "gpt-4.1-nano:batch": [5e-8, 2e-7, null, 1.25e-8, null], "reka-flash-3": [1e-7, 2e-7, null, null, null], "skyfall-36b-v2": [5.5e-7, 8e-7, null, 2.5e-7, null], "mistral-saba": [2e-7, 6e-7, null, 2e-8, null], "aion-rp-llama-3.1-8b": [8e-7, 0.0000016, null, null, null], "o3-mini:batch": [5.5e-7, 0.0000022, null, 2.75e-7, null], "minimax-01": [2e-7, 0.0000011, null, null, null], "l3.3-euryale-70b": [6.5e-7, 7.5e-7, null, null, null], "unslopnemo-12b": [4e-7, 4e-7, null, null, null], "magnum-v4-72b": [0.0000025, 0.000005, null, null, null], "qwen-2.5-7b-instruct": [1e-7, 2e-7, null, null, null], "l3.1-euryale-70b": [8.5e-7, 8.5e-7, null, null, null], "l3-lunaris-8b": [4e-8, 5e-8, null, null, null], "gpt-4o-mini:batch": [7.5e-8, 3e-7, null, 3.75e-8, null], "gemma-2-27b-it": [6.5e-7, 6.5e-7, null, null, null], "gpt-4o:batch": [0.00000125, 0.000005, null, 6.25e-7, null], "gpt-4-turbo:batch": [0.000005, 0.000015, null, null, null], "gpt-3.5-turbo-0613": [0.000001, 0.000002, null, null, null], "gpt-3.5-turbo:batch": [2.5e-7, 7.5e-7, null, null, null] }
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
// @ts-nocheck: codeburn type-checks this under its own tsconfig; Chompyy adds noUncheckedIndexedAccess (see UPSTREAM.md)
|
|
2
|
+
import { projectDayKey } from './daily-cache.js';
|
|
3
|
+
import { CATEGORY_LABELS } from './types.js';
|
|
4
|
+
import { behavioralCallWeight, isBehavioralTurn } from './behavioral-weight.js';
|
|
5
|
+
import { projectOriginKey } from './git-origin.js';
|
|
6
|
+
import { billableOutputTokens, modelRowKey, ownValue } from './models.js';
|
|
7
|
+
function emptyEntry(date) {
|
|
8
|
+
return {
|
|
9
|
+
date,
|
|
10
|
+
cost: 0,
|
|
11
|
+
savingsUSD: 0,
|
|
12
|
+
calls: 0,
|
|
13
|
+
sessions: 0,
|
|
14
|
+
inputTokens: 0,
|
|
15
|
+
outputTokens: 0,
|
|
16
|
+
cacheReadTokens: 0,
|
|
17
|
+
cacheWriteTokens: 0,
|
|
18
|
+
editTurns: 0,
|
|
19
|
+
oneShotTurns: 0,
|
|
20
|
+
models: Object.create(null),
|
|
21
|
+
categories: {},
|
|
22
|
+
providers: {},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function dateKey(iso) {
|
|
26
|
+
const d = new Date(iso);
|
|
27
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
|
28
|
+
}
|
|
29
|
+
/// Bucket an ISO timestamp under an explicit IANA timezone instead of the
|
|
30
|
+
/// machine's local one. `en-CA` emits the ISO-ish YYYY-MM-DD layout directly,
|
|
31
|
+
/// so formatToParts under the given `timeZone` yields exactly that shape. Used
|
|
32
|
+
/// to re-aggregate the same parse under a cache's OLD tzKey when a timezone
|
|
33
|
+
/// change forces a full re-derive (issue #770): comparing that bucketing to the
|
|
34
|
+
/// fresh one shows exactly which turns re-bucketed across local midnight.
|
|
35
|
+
export function dateKeyInTz(iso, tz) {
|
|
36
|
+
const parts = new Intl.DateTimeFormat('en-CA', { timeZone: tz, year: 'numeric', month: '2-digit', day: '2-digit' }).formatToParts(new Date(iso));
|
|
37
|
+
let year = '', month = '', day = '';
|
|
38
|
+
for (const p of parts) {
|
|
39
|
+
if (p.type === 'year')
|
|
40
|
+
year = p.value;
|
|
41
|
+
else if (p.type === 'month')
|
|
42
|
+
month = p.value;
|
|
43
|
+
else if (p.type === 'day')
|
|
44
|
+
day = p.value;
|
|
45
|
+
}
|
|
46
|
+
return `${year}-${month}-${day}`;
|
|
47
|
+
}
|
|
48
|
+
function emptySlice() {
|
|
49
|
+
return {
|
|
50
|
+
calls: 0, cost: 0, savingsUSD: 0,
|
|
51
|
+
sessions: 0, inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0,
|
|
52
|
+
editTurns: 0, oneShotTurns: 0, models: Object.create(null), categories: {},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function aggregateProjectsIntoDays(projects, dateKeyFn = dateKey) {
|
|
56
|
+
const byDate = new Map();
|
|
57
|
+
const ensure = (date) => {
|
|
58
|
+
let d = byDate.get(date);
|
|
59
|
+
if (!d) {
|
|
60
|
+
d = emptyEntry(date);
|
|
61
|
+
byDate.set(date, d);
|
|
62
|
+
}
|
|
63
|
+
return d;
|
|
64
|
+
};
|
|
65
|
+
const ensureSlice = (day, provider) => {
|
|
66
|
+
let s = day.providers[provider];
|
|
67
|
+
if (!s) {
|
|
68
|
+
s = emptySlice();
|
|
69
|
+
day.providers[provider] = s;
|
|
70
|
+
}
|
|
71
|
+
return s;
|
|
72
|
+
};
|
|
73
|
+
const ensureProject = (holder, project, path) => {
|
|
74
|
+
const projects = (holder.projects ??= {});
|
|
75
|
+
const key = projectDayKey(project, path);
|
|
76
|
+
// defineProperty so a project directory named "__proto__" becomes an own
|
|
77
|
+
// key instead of mutating the prototype link.
|
|
78
|
+
let p = Object.hasOwn(projects, key) ? projects[key] : undefined;
|
|
79
|
+
if (!p) {
|
|
80
|
+
const originKey = projectOriginKey(path);
|
|
81
|
+
p = { cost: 0, calls: 0, savingsUSD: 0, sessions: 0, ...(path ? { path } : {}), ...(originKey ? { originKey } : {}) };
|
|
82
|
+
Object.defineProperty(projects, key, { value: p, enumerable: true, writable: true, configurable: true });
|
|
83
|
+
}
|
|
84
|
+
return p;
|
|
85
|
+
};
|
|
86
|
+
// A session split across projects counts once per day and provider, on its
|
|
87
|
+
// earliest slice; each project it touched still counts it.
|
|
88
|
+
const splitHeads = new Map();
|
|
89
|
+
for (const project of projects) {
|
|
90
|
+
for (const session of project.sessions) {
|
|
91
|
+
if (!session.projectSplit)
|
|
92
|
+
continue;
|
|
93
|
+
const key = `${session.projectSplit.primaryProjectPath}\0${session.sessionId}`;
|
|
94
|
+
const head = splitHeads.get(key);
|
|
95
|
+
if (!head || session.firstTimestamp < head.firstTimestamp)
|
|
96
|
+
splitHeads.set(key, session);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
for (const project of projects) {
|
|
100
|
+
for (const session of project.sessions) {
|
|
101
|
+
const sessionDate = dateKeyFn(session.firstTimestamp);
|
|
102
|
+
const sessionDay = ensure(sessionDate);
|
|
103
|
+
const countsOnce = !session.projectSplit
|
|
104
|
+
|| splitHeads.get(`${session.projectSplit.primaryProjectPath}\0${session.sessionId}`) === session;
|
|
105
|
+
if (countsOnce)
|
|
106
|
+
sessionDay.sessions += 1;
|
|
107
|
+
ensureProject(sessionDay, session.project, project.projectPath).sessions += 1;
|
|
108
|
+
// A session belongs to exactly one provider; its calls all carry it.
|
|
109
|
+
const sessionProvider = session.turns.flatMap(t => t.assistantCalls)[0]?.provider;
|
|
110
|
+
if (sessionProvider) {
|
|
111
|
+
const slice = ensureSlice(sessionDay, sessionProvider);
|
|
112
|
+
if (countsOnce)
|
|
113
|
+
slice.sessions += 1;
|
|
114
|
+
ensureProject(slice, session.project, project.projectPath).sessions += 1;
|
|
115
|
+
}
|
|
116
|
+
for (const turn of session.turns) {
|
|
117
|
+
if (turn.assistantCalls.length === 0)
|
|
118
|
+
continue;
|
|
119
|
+
// Two bucketing rules, deliberately different per level:
|
|
120
|
+
// - Turn-level judgments (category, editTurns, oneShotTurns) stay
|
|
121
|
+
// anchored to the turn's day (its timestamp — the user-message time,
|
|
122
|
+
// or the re-anchored first surviving call when the parser sliced
|
|
123
|
+
// the turn to a range, and falling back to the first assistant call
|
|
124
|
+
// when the user line is missing). They describe the whole exchange,
|
|
125
|
+
// not a per-call sum, so a sliced straddling turn reports them on
|
|
126
|
+
// each side's anchor day — summed across days they inflate, which
|
|
127
|
+
// is the accepted, documented semantics (see review on #852).
|
|
128
|
+
// - Call-derived values (cost/savings/calls/tokens and the model,
|
|
129
|
+
// project, and provider-slice rollups built from them) bucket under
|
|
130
|
+
// EACH CALL's own local day (the per-call loop below). The parser
|
|
131
|
+
// slices straddling turns per range (issue #852), so every parse
|
|
132
|
+
// only holds in-range calls and per-call bucketing keeps day-N +
|
|
133
|
+
// day-N+1 equal to the whole range — and history.daily reconciled
|
|
134
|
+
// to the headline built from the same days. (Before the parser
|
|
135
|
+
// sliced per call, per-call bucketing here was what caused the
|
|
136
|
+
// constant offset against the whole-turn headline; the slice is
|
|
137
|
+
// what makes it exact now.)
|
|
138
|
+
const turnDate = dateKeyFn(turn.timestamp || turn.assistantCalls[0].timestamp);
|
|
139
|
+
const turnDay = ensure(turnDate);
|
|
140
|
+
// A turn whose calls are all supplementary accounting (copilot rollup
|
|
141
|
+
// / paired store rows) is not a behavioral exchange: its cost still
|
|
142
|
+
// lands in the category, but it must add no turn/edit weight here or
|
|
143
|
+
// sealed daily history diverges from the live session summaries
|
|
144
|
+
// (which apply the same rule in buildSessionSummary).
|
|
145
|
+
const behavioralTurn = isBehavioralTurn(turn);
|
|
146
|
+
const editTurns = behavioralTurn && turn.hasEdits ? 1 : 0;
|
|
147
|
+
const oneShotTurns = behavioralTurn && turn.hasEdits && turn.retries === 0 ? 1 : 0;
|
|
148
|
+
const turnCost = turn.assistantCalls.reduce((s, c) => s + c.costUSD, 0);
|
|
149
|
+
const turnSavings = turn.assistantCalls.reduce((s, c) => s + (c.savingsUSD ?? 0), 0);
|
|
150
|
+
turnDay.editTurns += editTurns;
|
|
151
|
+
turnDay.oneShotTurns += oneShotTurns;
|
|
152
|
+
const cat = turnDay.categories[turn.category] ?? { turns: 0, cost: 0, savingsUSD: 0, editTurns: 0, oneShotTurns: 0 };
|
|
153
|
+
if (behavioralTurn)
|
|
154
|
+
cat.turns += 1;
|
|
155
|
+
cat.cost += turnCost;
|
|
156
|
+
cat.savingsUSD += turnSavings;
|
|
157
|
+
cat.editTurns += editTurns;
|
|
158
|
+
cat.oneShotTurns += oneShotTurns;
|
|
159
|
+
turnDay.categories[turn.category] = cat;
|
|
160
|
+
// Cost stays attributed to every provider actually present in the turn,
|
|
161
|
+
// but turn counts belong to exactly one slice. Otherwise carrying one
|
|
162
|
+
// missing provider later re-adds a turn already present in the fresh
|
|
163
|
+
// provider's slice. Highest call count wins; when the first call's
|
|
164
|
+
// provider is tied for highest, replacing only on a strict increase
|
|
165
|
+
// leaves that provider selected.
|
|
166
|
+
const providersInTurn = new Map();
|
|
167
|
+
for (const call of turn.assistantCalls) {
|
|
168
|
+
const acc = providersInTurn.get(call.provider) ?? { calls: 0, cost: 0, savingsUSD: 0 };
|
|
169
|
+
acc.calls += 1;
|
|
170
|
+
acc.cost += call.costUSD;
|
|
171
|
+
acc.savingsUSD += call.savingsUSD ?? 0;
|
|
172
|
+
providersInTurn.set(call.provider, acc);
|
|
173
|
+
}
|
|
174
|
+
let primaryProvider = turn.assistantCalls[0].provider;
|
|
175
|
+
let primaryCalls = providersInTurn.get(primaryProvider).calls;
|
|
176
|
+
for (const [provider, totals] of providersInTurn) {
|
|
177
|
+
if (totals.calls > primaryCalls) {
|
|
178
|
+
primaryProvider = provider;
|
|
179
|
+
primaryCalls = totals.calls;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
for (const [prov, totals] of providersInTurn) {
|
|
183
|
+
const turnSlice = ensureSlice(turnDay, prov);
|
|
184
|
+
const ownsTurn = prov === primaryProvider;
|
|
185
|
+
turnSlice.editTurns += ownsTurn ? editTurns : 0;
|
|
186
|
+
turnSlice.oneShotTurns += ownsTurn ? oneShotTurns : 0;
|
|
187
|
+
const sliceCat = turnSlice.categories[turn.category] ?? { turns: 0, cost: 0, savingsUSD: 0, editTurns: 0, oneShotTurns: 0 };
|
|
188
|
+
sliceCat.turns += ownsTurn && behavioralTurn ? 1 : 0;
|
|
189
|
+
sliceCat.cost += totals.cost;
|
|
190
|
+
sliceCat.savingsUSD += totals.savingsUSD;
|
|
191
|
+
sliceCat.editTurns += ownsTurn ? editTurns : 0;
|
|
192
|
+
sliceCat.oneShotTurns += ownsTurn ? oneShotTurns : 0;
|
|
193
|
+
turnSlice.categories[turn.category] = sliceCat;
|
|
194
|
+
}
|
|
195
|
+
for (const call of turn.assistantCalls) {
|
|
196
|
+
const callSavings = call.savingsUSD ?? 0;
|
|
197
|
+
// Same weight rule as buildSessionSummary: a supplementary
|
|
198
|
+
// accounting call contributes cost/tokens but is not a distinct
|
|
199
|
+
// request, so it must not increment any `calls` counter the daily
|
|
200
|
+
// cache seals (day, project, model, provider slice).
|
|
201
|
+
const callWeight = behavioralCallWeight(call);
|
|
202
|
+
// Call-derived values bucket under the call's OWN day (see the
|
|
203
|
+
// two-rule comment above). An unparseable call timestamp falls back
|
|
204
|
+
// to the turn's anchor day rather than producing a garbage date key.
|
|
205
|
+
const callDate = Number.isNaN(new Date(call.timestamp).getTime()) ? turnDate : dateKeyFn(call.timestamp);
|
|
206
|
+
const callDay = ensure(callDate);
|
|
207
|
+
callDay.cost += call.costUSD;
|
|
208
|
+
callDay.savingsUSD += callSavings;
|
|
209
|
+
callDay.calls += callWeight;
|
|
210
|
+
const billableOut = billableOutputTokens(call.provider, call.usage.outputTokens, call.usage.reasoningTokens);
|
|
211
|
+
callDay.inputTokens += call.usage.inputTokens;
|
|
212
|
+
callDay.outputTokens += billableOut;
|
|
213
|
+
callDay.cacheReadTokens += call.usage.cacheReadInputTokens;
|
|
214
|
+
callDay.cacheWriteTokens += call.usage.cacheCreationInputTokens;
|
|
215
|
+
const dayProject = ensureProject(callDay, session.project, project.projectPath);
|
|
216
|
+
dayProject.cost += call.costUSD;
|
|
217
|
+
dayProject.calls += callWeight;
|
|
218
|
+
dayProject.savingsUSD += callSavings;
|
|
219
|
+
// Keyed by the same row key every report uses, so a route sourced
|
|
220
|
+
// from a provider column (Hermes `billing_provider`) survives into
|
|
221
|
+
// the finalized day: the raw id alone cannot carry it. v33.
|
|
222
|
+
const dayModelKey = modelRowKey(call.model, call.route);
|
|
223
|
+
const model = ownValue(callDay.models, dayModelKey) ?? {
|
|
224
|
+
calls: 0, cost: 0, savingsUSD: 0,
|
|
225
|
+
inputTokens: 0, outputTokens: 0,
|
|
226
|
+
cacheReadTokens: 0, cacheWriteTokens: 0,
|
|
227
|
+
};
|
|
228
|
+
model.calls += callWeight;
|
|
229
|
+
model.cost += call.costUSD;
|
|
230
|
+
model.savingsUSD += callSavings;
|
|
231
|
+
model.inputTokens += call.usage.inputTokens;
|
|
232
|
+
model.outputTokens += billableOut;
|
|
233
|
+
model.cacheReadTokens += call.usage.cacheReadInputTokens;
|
|
234
|
+
model.cacheWriteTokens += call.usage.cacheCreationInputTokens;
|
|
235
|
+
callDay.models[dayModelKey] = model;
|
|
236
|
+
const slice = ensureSlice(callDay, call.provider);
|
|
237
|
+
slice.calls += callWeight;
|
|
238
|
+
slice.cost += call.costUSD;
|
|
239
|
+
slice.savingsUSD += callSavings;
|
|
240
|
+
slice.inputTokens += call.usage.inputTokens;
|
|
241
|
+
slice.outputTokens += billableOut;
|
|
242
|
+
slice.cacheReadTokens += call.usage.cacheReadInputTokens;
|
|
243
|
+
slice.cacheWriteTokens += call.usage.cacheCreationInputTokens;
|
|
244
|
+
const sliceProject = ensureProject(slice, session.project, project.projectPath);
|
|
245
|
+
sliceProject.cost += call.costUSD;
|
|
246
|
+
sliceProject.calls += callWeight;
|
|
247
|
+
sliceProject.savingsUSD += callSavings;
|
|
248
|
+
const sliceModel = ownValue(slice.models, dayModelKey) ?? {
|
|
249
|
+
calls: 0, cost: 0, savingsUSD: 0,
|
|
250
|
+
inputTokens: 0, outputTokens: 0,
|
|
251
|
+
cacheReadTokens: 0, cacheWriteTokens: 0,
|
|
252
|
+
};
|
|
253
|
+
sliceModel.calls += callWeight;
|
|
254
|
+
sliceModel.cost += call.costUSD;
|
|
255
|
+
sliceModel.savingsUSD += callSavings;
|
|
256
|
+
sliceModel.inputTokens += call.usage.inputTokens;
|
|
257
|
+
sliceModel.outputTokens += billableOut;
|
|
258
|
+
sliceModel.cacheReadTokens += call.usage.cacheReadInputTokens;
|
|
259
|
+
sliceModel.cacheWriteTokens += call.usage.cacheCreationInputTokens;
|
|
260
|
+
slice.models[dayModelKey] = sliceModel;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return [...byDate.values()].sort((a, b) => a.date.localeCompare(b.date));
|
|
266
|
+
}
|
|
267
|
+
export function buildPeriodDataFromDays(days, label) {
|
|
268
|
+
let cost = 0, savingsUSD = 0, calls = 0, sessions = 0;
|
|
269
|
+
let inputTokens = 0, outputTokens = 0, cacheReadTokens = 0, cacheWriteTokens = 0;
|
|
270
|
+
const catTotals = {};
|
|
271
|
+
// Per-model token counts, normalized the same way the day entries were
|
|
272
|
+
// written (output already billable — day-aggregator folds reasoning in per
|
|
273
|
+
// call). Merge keys stay the raw ids here; the payload resolves display
|
|
274
|
+
// names later (buildTopModels), so both aggregation paths land in the same
|
|
275
|
+
// rows as cost.
|
|
276
|
+
const modelTotals = Object.create(null);
|
|
277
|
+
for (const d of days) {
|
|
278
|
+
cost += d.cost;
|
|
279
|
+
savingsUSD += d.savingsUSD;
|
|
280
|
+
calls += d.calls;
|
|
281
|
+
sessions += d.sessions;
|
|
282
|
+
inputTokens += d.inputTokens;
|
|
283
|
+
outputTokens += d.outputTokens;
|
|
284
|
+
cacheReadTokens += d.cacheReadTokens;
|
|
285
|
+
cacheWriteTokens += d.cacheWriteTokens;
|
|
286
|
+
for (const [name, m] of Object.entries(d.models)) {
|
|
287
|
+
const acc = ownValue(modelTotals, name) ?? {
|
|
288
|
+
calls: 0, cost: 0, savingsUSD: 0,
|
|
289
|
+
inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0,
|
|
290
|
+
};
|
|
291
|
+
acc.calls += m.calls;
|
|
292
|
+
acc.cost += m.cost;
|
|
293
|
+
acc.savingsUSD += (m.savingsUSD ?? 0);
|
|
294
|
+
acc.inputTokens += m.inputTokens;
|
|
295
|
+
acc.outputTokens += m.outputTokens;
|
|
296
|
+
acc.cacheReadTokens += m.cacheReadTokens;
|
|
297
|
+
acc.cacheWriteTokens += m.cacheWriteTokens;
|
|
298
|
+
modelTotals[name] = acc;
|
|
299
|
+
}
|
|
300
|
+
for (const [cat, c] of Object.entries(d.categories)) {
|
|
301
|
+
const acc = catTotals[cat] ?? { turns: 0, cost: 0, savingsUSD: 0, editTurns: 0, oneShotTurns: 0 };
|
|
302
|
+
acc.turns += c.turns;
|
|
303
|
+
acc.cost += c.cost;
|
|
304
|
+
acc.savingsUSD += (c.savingsUSD ?? 0);
|
|
305
|
+
acc.editTurns += c.editTurns;
|
|
306
|
+
acc.oneShotTurns += c.oneShotTurns;
|
|
307
|
+
catTotals[cat] = acc;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
label,
|
|
312
|
+
cost,
|
|
313
|
+
savingsUSD,
|
|
314
|
+
calls,
|
|
315
|
+
sessions,
|
|
316
|
+
inputTokens,
|
|
317
|
+
outputTokens,
|
|
318
|
+
cacheReadTokens,
|
|
319
|
+
cacheWriteTokens,
|
|
320
|
+
categories: Object.entries(catTotals)
|
|
321
|
+
.sort(([, a], [, b]) => b.cost - a.cost)
|
|
322
|
+
.map(([cat, d]) => ({ name: CATEGORY_LABELS[cat] ?? cat, rawCategory: cat, ...d })),
|
|
323
|
+
models: Object.entries(modelTotals)
|
|
324
|
+
.sort(([, a], [, b]) => b.cost - a.cost)
|
|
325
|
+
.map(([name, d]) => ({ name, ...d })),
|
|
326
|
+
};
|
|
327
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @ts-nocheck: codeburn type-checks this under its own tsconfig; Chompyy adds noUncheckedIndexedAccess (see UPSTREAM.md)
|
|
2
|
+
import { posix, win32 } from 'node:path';
|
|
3
|
+
/** Default Electron editor data directory, honoring the OS's redirected root. */
|
|
4
|
+
export function getEditorDataDir(editor, home, os) {
|
|
5
|
+
if (os === 'darwin')
|
|
6
|
+
return posix.join(home, 'Library', 'Application Support', editor);
|
|
7
|
+
if (os === 'win32') {
|
|
8
|
+
return win32.join(process.env['APPDATA'] || win32.join(home, 'AppData', 'Roaming'), editor);
|
|
9
|
+
}
|
|
10
|
+
return posix.join(process.env['XDG_CONFIG_HOME'] || posix.join(home, '.config'), editor);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @ts-nocheck: codeburn type-checks this under its own tsconfig; Chompyy adds noUncheckedIndexedAccess (see UPSTREAM.md)
|
|
2
|
+
// Default ceiling for outbound HTTP. Every CLI command awaits loadPricing(),
|
|
3
|
+
// and the macOS menubar shells out to the CLI and blocks on its exit — so an
|
|
4
|
+
// unbounded fetch() on a half-open network (e.g. Wi-Fi/DNS not yet up after
|
|
5
|
+
// wake-from-sleep) wedges the menubar on its loading spinner indefinitely.
|
|
6
|
+
// 8s is generous for these small JSON endpoints while still failing fast.
|
|
7
|
+
export const DEFAULT_FETCH_TIMEOUT_MS = 8000;
|
|
8
|
+
/// fetch() with a hard timeout. On timeout the returned promise rejects with a
|
|
9
|
+
/// TimeoutError (an AbortError subtype), which callers already handle via their
|
|
10
|
+
/// existing try/catch + bundled-snapshot fallback. A caller-supplied signal is
|
|
11
|
+
/// combined with the timeout so either can abort the request.
|
|
12
|
+
export async function fetchWithTimeout(url, init = {}, timeoutMs = DEFAULT_FETCH_TIMEOUT_MS) {
|
|
13
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
14
|
+
const signal = init.signal
|
|
15
|
+
? AbortSignal.any([init.signal, timeoutSignal])
|
|
16
|
+
: timeoutSignal;
|
|
17
|
+
return fetch(url, { ...init, signal });
|
|
18
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// @ts-nocheck: codeburn type-checks this under its own tsconfig; Chompyy adds noUncheckedIndexedAccess (see UPSTREAM.md)
|
|
2
|
+
import chalk from '../shims/chalk.js';
|
|
3
|
+
import { behavioralCallCount } from './behavioral-weight.js';
|
|
4
|
+
// Re-exported from currency.ts so existing imports from './format.js' keep working.
|
|
5
|
+
// The currency-aware version applies exchange rate and symbol automatically.
|
|
6
|
+
// Imported locally too since renderStatusBar below uses it directly.
|
|
7
|
+
import { formatCost } from './currency.js';
|
|
8
|
+
export { formatCost };
|
|
9
|
+
/// Prefix a formatted cost with the estimated marker (`~`) when the figure is
|
|
10
|
+
/// priced from estimated tokens rather than metered. Keeps the marker identical
|
|
11
|
+
/// across the report, overview, and MCP surfaces so a legend line can explain it
|
|
12
|
+
/// once. `isEstimated` is typically `isEstimatedCost(entry.cost, entry.estimatedCostUSD)`.
|
|
13
|
+
export function markEstimated(costStr, isEstimated) {
|
|
14
|
+
return isEstimated ? `~${costStr}` : costStr;
|
|
15
|
+
}
|
|
16
|
+
export const ESTIMATED_COST_LEGEND = '~ estimated cost (priced from estimated tokens)';
|
|
17
|
+
/// A row carries the estimated marker once its estimated portion is at least 1%
|
|
18
|
+
/// of its cost: a handful of unmetered calls inside a metered row (a Codex turn
|
|
19
|
+
/// with no token record) must not mark the whole row as a guess. `shown` is the
|
|
20
|
+
/// amount as the surface prints it; a figure that reads as zero ("$0.00") gets
|
|
21
|
+
/// no marker, since there is nothing visible to qualify.
|
|
22
|
+
export function isEstimatedCost(costUSD, estimatedCostUSD, shown = formatCost(costUSD)) {
|
|
23
|
+
const estimated = estimatedCostUSD ?? 0;
|
|
24
|
+
return estimated > 0 && estimated >= costUSD * 0.01 && /[1-9]/.test(shown);
|
|
25
|
+
}
|
|
26
|
+
/// Shared wording for the durable-cache carry-forward footnote: some of a
|
|
27
|
+
/// period's total came from days whose session logs have since expired, but
|
|
28
|
+
/// the figure is real (preserved in the durable daily cache). overview.ts and
|
|
29
|
+
/// dashboard.tsx both show this so a headline that includes carried days
|
|
30
|
+
/// doesn't read as inconsistent with detail views that can only see
|
|
31
|
+
/// surviving session files.
|
|
32
|
+
export function carriedCostNote(carriedCostUSD) {
|
|
33
|
+
return carriedCostUSD > 0 ? `includes ${formatCost(carriedCostUSD)} preserved from expired session logs` : null;
|
|
34
|
+
}
|
|
35
|
+
/// Shared wording for the gateway-exclusion footnote. A Vercel AI Gateway row
|
|
36
|
+
/// is a daily aggregate the local tools routed through the gateway already
|
|
37
|
+
/// report, so it is shown but never added to a total. overview.ts and
|
|
38
|
+
/// dashboard.tsx both print this so a headline that is short of the provider
|
|
39
|
+
/// list explains itself.
|
|
40
|
+
export function excludedGatewayNote(excludedGatewayCostUSD) {
|
|
41
|
+
return excludedGatewayCostUSD > 0
|
|
42
|
+
? `excludes ${formatCost(excludedGatewayCostUSD)} of Vercel AI Gateway daily totals (your local tools may already count it) — include with: codeburn gateway-totals include`
|
|
43
|
+
: null;
|
|
44
|
+
}
|
|
45
|
+
export function formatTokens(n) {
|
|
46
|
+
// Guard against Infinity / NaN / negatives that would otherwise leak into
|
|
47
|
+
// the UI as "Infinity" or "NaN" strings when an upstream calculation glitches.
|
|
48
|
+
if (!Number.isFinite(n))
|
|
49
|
+
return '?';
|
|
50
|
+
if (n < 0)
|
|
51
|
+
return '0';
|
|
52
|
+
if (n >= 1_000_000_000)
|
|
53
|
+
return `${(n / 1_000_000_000).toFixed(1)}B`;
|
|
54
|
+
if (n >= 1_000_000)
|
|
55
|
+
return `${(n / 1_000_000).toFixed(1)}M`;
|
|
56
|
+
if (n >= 1_000)
|
|
57
|
+
return `${(n / 1_000).toFixed(1)}K`;
|
|
58
|
+
return Math.round(n).toString();
|
|
59
|
+
}
|
|
60
|
+
/// Returns YYYY-MM-DD for the given date in the process-local timezone. Cheaper than shelling
|
|
61
|
+
/// out to Intl.DateTimeFormat for every turn in a loop and avoids the UTC drift that bites
|
|
62
|
+
/// `Date.toISOString().slice(0,10)` whenever the user runs this between local midnight and
|
|
63
|
+
/// UTC midnight.
|
|
64
|
+
function localDateString(d) {
|
|
65
|
+
const y = d.getFullYear();
|
|
66
|
+
const m = String(d.getMonth() + 1).padStart(2, '0');
|
|
67
|
+
const day = String(d.getDate()).padStart(2, '0');
|
|
68
|
+
return `${y}-${m}-${day}`;
|
|
69
|
+
}
|
|
70
|
+
export function renderStatusBar(projects, totals) {
|
|
71
|
+
const now = new Date();
|
|
72
|
+
const today = localDateString(now);
|
|
73
|
+
const monthStart = `${today.slice(0, 7)}-01`;
|
|
74
|
+
let todayCost = 0, todayCalls = 0, monthCost = 0, monthCalls = 0;
|
|
75
|
+
if (totals) {
|
|
76
|
+
todayCost = totals.today.cost;
|
|
77
|
+
todayCalls = totals.today.calls;
|
|
78
|
+
monthCost = totals.month.cost;
|
|
79
|
+
monthCalls = totals.month.calls;
|
|
80
|
+
const lines = [''];
|
|
81
|
+
lines.push(` ${chalk.bold('Today')} ${chalk.yellowBright(formatCost(todayCost))} ${chalk.dim(`${todayCalls} calls`)} ${chalk.bold('Month')} ${chalk.yellowBright(formatCost(monthCost))} ${chalk.dim(`${monthCalls} calls`)}`);
|
|
82
|
+
lines.push('');
|
|
83
|
+
return lines.join('\n');
|
|
84
|
+
}
|
|
85
|
+
for (const project of projects) {
|
|
86
|
+
for (const session of project.sessions) {
|
|
87
|
+
for (const turn of session.turns) {
|
|
88
|
+
if (turn.assistantCalls.length === 0)
|
|
89
|
+
continue;
|
|
90
|
+
// Bucket by the first assistant call's local date -- the moment the cost was
|
|
91
|
+
// incurred. Bucketing by `turn.timestamp` (the user message time) drops turns
|
|
92
|
+
// that straddle midnight (user asked at 23:58, response arrived at 00:30) and
|
|
93
|
+
// disagrees with parseAllSessions' dateRange filter which is also on assistant
|
|
94
|
+
// time.
|
|
95
|
+
const bucketTs = turn.assistantCalls[0].timestamp;
|
|
96
|
+
if (!bucketTs)
|
|
97
|
+
continue;
|
|
98
|
+
const day = localDateString(new Date(bucketTs));
|
|
99
|
+
const turnCost = turn.assistantCalls.reduce((s, c) => s + c.costUSD, 0);
|
|
100
|
+
// Cost keeps every call; the calls figure counts only behavioral ones,
|
|
101
|
+
// so a supplementary-only turn still spends but adds no requests.
|
|
102
|
+
const turnCalls = behavioralCallCount(turn.assistantCalls);
|
|
103
|
+
if (day === today) {
|
|
104
|
+
todayCost += turnCost;
|
|
105
|
+
todayCalls += turnCalls;
|
|
106
|
+
}
|
|
107
|
+
if (day >= monthStart) {
|
|
108
|
+
monthCost += turnCost;
|
|
109
|
+
monthCalls += turnCalls;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const lines = [''];
|
|
115
|
+
lines.push(` ${chalk.bold('Today')} ${chalk.yellowBright(formatCost(todayCost))} ${chalk.dim(`${todayCalls} calls`)} ${chalk.bold('Month')} ${chalk.yellowBright(formatCost(monthCost))} ${chalk.dim(`${monthCalls} calls`)}`);
|
|
116
|
+
lines.push('');
|
|
117
|
+
return lines.join('\n');
|
|
118
|
+
}
|