Skip to content

feat(anthropic): full OAuth token support for Anthropic provider#620

Open
codevjs wants to merge 5 commits intoValueCell-ai:mainfrom
codevjs:feat/anthropic-oauth-support
Open

feat(anthropic): full OAuth token support for Anthropic provider#620
codevjs wants to merge 5 commits intoValueCell-ai:mainfrom
codevjs:feat/anthropic-oauth-support

Conversation

@codevjs
Copy link
Copy Markdown

@codevjs codevjs commented Apr 1, 2026

Summary

  • AnthropicProvider: Add dedicated provider class in factory.py with OAuth token support and Claude Code headers (anthropic-beta: oauth-2025-04-20)
  • validate_provider fix: Accept auth_token_env as alternative to api_key — Anthropic OAuth users no longer get "API key not found" error when using OAuth token instead of API key
  • Settings UI: Replace unreliable onBlur auto-save with explicit Save button; add auth_token_set indicator ("✓ Token already saved") so user knows token is persisted after page refresh
  • Check availability fix: Treat HTTP 429 rate_limit as success — token is valid even when rate limited
  • Token persistence fix: Empty string no longer wipes saved auth_token on page reload
  • Docker: Add docker-compose.yml, Dockerfile.frontend, nginx config, and named volume for user config persistence across container restarts
  • CLAUDE.md: Add project documentation for AI-assisted development

Test plan

  • Settings → Models → Anthropic: enter sk-ant-oat01-... token, click Save → green "✓ Token already saved" appears
  • Refresh page → "✓ Token already saved" still shown, token not wiped
  • Click Check Availability → returns ok: true / reachable
  • Send message to agent → agent responds (no "API key not found" error in logs)
  • docker compose up -d --build → container starts, token loaded from volume on restart

🤖 Generated with Claude Code

Raka (SDI Head) and others added 5 commits April 1, 2026 04:46
- Add anthropic.png logo to model-providers assets
- Register AnthropicPng in assets/png/index.ts
- Add anthropic entry to MODEL_PROVIDER_ICONS
- Add conditional form in model-detail.tsx:
  - Anthropic: shows OAuth Token field (ANTHROPIC_AUTH_TOKEN)
  - Other providers: shows standard API key field
- Hide API Host field for Anthropic provider
- ai-model-form.tsx: conditionally hide API key input when provider=anthropic
- Show info box explaining OAuth token is used from server environment
- Prevents user confusion when adding trading strategy with Anthropic
Backend:
- ProviderUpdateRequest: add auth_token field
- update_provider_config: save auth_token via auth_token_env
- check_model: Anthropic uses direct SDK call with OAuth headers

Frontend:
- api/setting.ts: pass auth_token in updateConfig mutation
- Add AnthropicProvider to factory with OAuth token + Claude Code headers
- Fix validate_provider() to accept auth_token as alternative to api_key
- Add Save button to Anthropic OAuth field in settings UI (replace onBlur)
- Add auth_token_set field to provider detail API so UI can show saved status
- Fix check availability: treat 429 rate_limit as success (token is valid)
- Fix token persistence: empty string no longer clears saved auth token
- Add Docker Compose setup with volume mount for user config persistence
- Add CLAUDE.md project documentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant