Commit Graph

1 Commits

Author SHA1 Message Date
admin 83a933ea1a feat: LLM task extraction, token tracking, direct Claude brain
- brain.py: prefers direct Anthropic API (ANTHROPIC_API_KEY) over Hermes
  for all LLM calls — ~22x cheaper (122 tokens vs 5600+ Hermes overhead).
  Falls back to Hermes then Ollama if key unavailable.
  extract_task_fields(): non-streaming call returns clean {title, project}
  from any natural language phrasing — no more regex whack-a-mole.
- token_log.py: appends every LLM call to token-usage.jsonl with intent,
  in/out token counts, and USD cost. get_summary() aggregates all-time,
  today, and per-intent breakdowns.
- main.py: task handler uses extract_task_fields() with regex fallback;
  streaming handler captures usage from final chunk; GET /usage endpoint
  returns live cost summary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 14:20:47 +00:00