Documentation Index
Fetch the complete documentation index at: https://docs.avocadostudio.dev/llms.txt
Use this file to discover all available pages before exploring further.
Token Usage & Cost Tracking
The orchestrator tracks LLM token usage and estimated cost for every AI-powered chat and variation request. This data is available through three channels: the editor debug panel, browser DevTools, server logs, and telemetry API endpoints.Editor Debug Panel
The editor has a built-in debug overlay that shows per-message metadata.- Open the editor at
http://localhost:4100 - Toggle debug mode (the setting persists in localStorage)
- Send a chat message
- Each assistant response shows a Debug section with
traceId,outcome,intent,opCount, andops
Note: Token and cache counts (inputTokens,outputTokens,cacheReadInputTokens,cacheCreationInputTokens,estimatedUsd) are included in the debug payload but not yet rendered in the panel. To see them, use the Network tab or telemetry API (below).
Browser DevTools (Network Tab)
Every/chat POST response includes a debug object:
POST /chat/variations), usage is a top-level field:
Server Logs
The orchestrator logs every telemetry event with token data. Look for"event":"chat_telemetry" lines in the terminal running pnpm dev:orchestrator:
plan_generated— after the AI returns a planresult— final outcome (applied,needs_clarification,plan_ready_for_approval, etc.)
Telemetry API
Two HTTP endpoints expose stored telemetry:List events
inputTokens, outputTokens, totalTokens, cacheReadInputTokens, cacheCreationInputTokens, and estimatedUsd when available.
Failure review
Pricing Table
Cost estimates use a built-in pricing table with prefix matching (e.g.claude-sonnet-4-6 matches claude-sonnet):
| Model prefix | Input ($/1M tokens) | Output ($/1M tokens) |
|---|---|---|
gpt-4o-mini | 0.15 | 0.60 |
gpt-4o | 2.50 | 10.00 |
gpt-5 | 1.75 | 14.00 |
claude-haiku | 0.80 | 4.00 |
claude-sonnet | 3.00 | 15.00 |
claude-opus | 15.00 | 75.00 |
estimatedUsd is null.
To update pricing, edit USD_PER_MTOK in apps/orchestrator/src/telemetry/usage.ts.
Limitations
- Streaming requests return zero token counts (OpenAI streaming doesn’t include per-chunk usage data)
- Anthropic streaming captures usage via
stream.finalMessage()after the stream completes cacheReadInputTokensmaps to OpenAIcached_tokensand Anthropiccache_read_input_tokenscacheCreationInputTokensis currently provided by Anthropic (cache_creation_input_tokens)- Image generation and audio are not tracked
- Cost is an estimate based on list pricing; actual billing may differ