Files
Tuan NguyenandClaude Opus 5 4f469431ab feat(llm): add Claude Code provider using a Claude subscription
Claude Pro / Max / Team subscriptions do not issue API keys, and their
credentials are only usable by Anthropic's own clients, so the existing
`anthropic` provider is unavailable to subscription-only users.

This adds a `claude_code` provider that shells out to the locally installed,
logged-in `claude` CLI in headless mode (`claude -p --output-format json`)
instead of calling the HTTP API, letting the CLI perform authentication.
Requests consume subscription usage rather than API credit.

Details:
- Registry entry needs no API key, no base URL, and no model name; an empty
  model name follows whatever default the CLI currently uses.
- The adapter replaces Claude Code's coding-agent system prompt with a
  copywriter prompt, disables all tools and external MCP config, and runs in
  a temporary working directory so a stray CLAUDE.md cannot leak into script
  output. Each call is a deterministic single-turn text generation.
- Failures are reported from the CLI's JSON payload (`is_error` / `result`)
  rather than the exit code alone, since auth and quota errors arrive as a
  non-zero exit with a readable message on stdout.
- Dockerfile.claude layers Node.js and the claude CLI onto the published
  image; docker-compose.claude.yml mounts the project and injects
  CLAUDE_CODE_OAUTH_TOKEN, which is how the CLI authenticates in a container
  where no keychain is available.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 23:59:03 +07:00

48 lines
777 B
Plaintext

.DS_Store
/config.toml
/config.toml.bak
/storage/
/.idea/
/app/services/__pycache__
/app/__pycache__/
/app/config/__pycache__/
/app/models/__pycache__/
/app/utils/__pycache__/
/*/__pycache__/*
.vscode
/**/.streamlit
__pycache__
logs/
node_modules
# VuePress 默认临时文件目录
/sites/docs/.vuepress/.temp
# VuePress 默认缓存目录
/sites/docs/.vuepress/.cache
# VuePress 默认构建生成的静态文件目录
/sites/docs/.vuepress/dist
# 模型目录
/models/
./models/*
venv/
.venv
# Debug and test files
CLAUDE.md
debug/
debug_*.py
test_*.py
!test/services/test_*.py
!test/test_*.py
streamlit.log
.coverage
coverage.xml
htmlcov/
.codegraph
/docs/superpowers
.understand-anything
# Claude Code 订阅令牌(docker compose 自动读取),禁止提交
.env