feat(score): add Claude CLI backend via subscription token #1

Merged
hjess merged 1 commits from feat/claude-cli-backend into main 2026-10-29 21:59:35 +01:00
Owner

Replace the direct Anthropic API call in score.py with a pluggable backend
(BLAAAI_BACKEND=cli|api, default cli). The CLI path shells out to claude -p
authed by CLAUDE_CODE_OAUTH_TOKEN, so scoring counts against the Claude
subscription instead of API billing.

  • _call_cli forces a tool-free, JSON-only role (--append-system-prompt,
    --disallowed-tools) and retries the intermittently-failing claude -p
  • lower default concurrency (3) since each call spawns a heavy Node process
  • metrics use the CLI's reported total_cost_usd and full token load
  • batch failures no longer crash the whole scoring run
  • remove the hardcoded live ANTHROPIC_API_KEY fallback (rotate it in console)
  • Dockerfile installs Node + @anthropic-ai/claude-code
  • Nomad injects CLAUDE_CODE_OAUTH_TOKEN via Consul, bumps memory for Node
Replace the direct Anthropic API call in score.py with a pluggable backend (BLAAAI_BACKEND=cli|api, default cli). The CLI path shells out to `claude -p` authed by CLAUDE_CODE_OAUTH_TOKEN, so scoring counts against the Claude subscription instead of API billing. - _call_cli forces a tool-free, JSON-only role (--append-system-prompt, --disallowed-tools) and retries the intermittently-failing `claude -p` - lower default concurrency (3) since each call spawns a heavy Node process - metrics use the CLI's reported total_cost_usd and full token load - batch failures no longer crash the whole scoring run - remove the hardcoded live ANTHROPIC_API_KEY fallback (rotate it in console) - Dockerfile installs Node + @anthropic-ai/claude-code - Nomad injects CLAUDE_CODE_OAUTH_TOKEN via Consul, bumps memory for Node
hjess added 1 commit 2026-10-29 21:59:32 +01:00
Replace the direct Anthropic API call in score.py with a pluggable backend
(BLAAAI_BACKEND=cli|api, default cli). The CLI path shells out to `claude -p`
authed by CLAUDE_CODE_OAUTH_TOKEN, so scoring counts against the Claude
subscription instead of API billing.

- _call_cli forces a tool-free, JSON-only role (--append-system-prompt,
  --disallowed-tools) and retries the intermittently-failing `claude -p`
- lower default concurrency (3) since each call spawns a heavy Node process
- metrics use the CLI's reported total_cost_usd and full token load
- batch failures no longer crash the whole scoring run
- remove the hardcoded live ANTHROPIC_API_KEY fallback (rotate it in console)
- Dockerfile installs Node + @anthropic-ai/claude-code
- Nomad injects CLAUDE_CODE_OAUTH_TOKEN via Consul, bumps memory for Node
hjess merged commit db8b4d0406 into main 2026-10-29 21:59:35 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hjess/BlaaAI#1