mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 00:16:38 +00:00
feat(api): add Anthropic direct API key support
Support native Anthropic API keys (sk-ant-...) via `ccs api create --preset anthropic`. Profiles use ANTHROPIC_API_KEY env var without BASE_URL, letting Claude CLI authenticate natively with x-api-key header instead of proxy Bearer token. - Add anthropic preset to provider catalog - Branch profile-writer env structure (native vs proxy) - Add validateAnthropicKey() preflight with x-api-key header - Auto-detect api.anthropic.com URL in interactive flow - Fix hasApiKey/isConfigured to recognize ANTHROPIC_API_KEY - Update delegation-validator for native mode profiles - Add Droid target API key fallback (ANTHROPIC_API_KEY) Closes #688 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
0c4d5244c8
commit
fedb4d4cde
11 files changed
+301
-20
No files matched your search
@@ -467,6 +467,34 @@ function selectBestAccount(accounts: AccountInfo[]): AccountInfo | null {
|
||||
└─ Droid: config file (~/.factory/settings.json)
|
||||
```
|
||||
|
||||
### Anthropic Direct API Key
|
||||
|
||||
```
|
||||
+===========================================================================+
|
||||
| Anthropic Direct API Key (Native Auth) |
|
||||
+===========================================================================+
|
||||
|
||||
1. User creates profile: ccs api create --preset anthropic
|
||||
|
|
||||
v
|
||||
2. Key stored in ~/.ccs/<profile>.settings.json
|
||||
| env: { ANTHROPIC_API_KEY: "sk-ant-..." }
|
||||
| (NO ANTHROPIC_BASE_URL, NO ANTHROPIC_AUTH_TOKEN)
|
||||
v
|
||||
3. Profile detection: settings-based
|
||||
|
|
||||
v
|
||||
4. Key passed via ANTHROPIC_API_KEY env var
|
||||
| Claude CLI uses native endpoint (api.anthropic.com)
|
||||
v
|
||||
5. Claude CLI authenticates with x-api-key header
|
||||
|
||||
Detection logic (profile-writer.ts):
|
||||
- apiKey.startsWith('sk-ant-') -> native mode
|
||||
- baseUrl.includes('api.anthropic.com') -> native mode
|
||||
- Otherwise -> proxy mode (existing behavior)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Image Analysis Hook Flow (v7.34)
|
||||
|
||||
Reference in new issue
Block a user