Troubleshooting
401 Authentication Error
Symptom: Claude Code returns "Authentication error" or "Invalid API key".
Steps to resolve:
- Confirm your API key format is correct (should start with
ck-):
terminal
bash
echo $ANTHROPIC_API_KEY # Should output ck-xxxxxxxxxxxx
- Verify the key is valid with curl:
terminal
bash
curl -s https://api.chuizi.ai/v1/key/info \ -H "Authorization: Bearer $ANTHROPIC_API_KEY" | jq
- If this returns an error, the cause is likely:
- Key was deleted or disabled -- check key status at app.chuizi.ai
- Key was partially copied -- recopy the full key
- Environment variable not loaded -- run
source ~/.zshrcor open a new terminal
Connection Timeout
Symptom: Requests hang for a long time before timing out.
Steps to resolve:
- Test connectivity to Chuizi.AI:
terminal
bash
curl -I https://api.chuizi.ai/health
- Confirm
ANTHROPIC_BASE_URLis set correctly:
terminal
bash
echo $ANTHROPIC_BASE_URL # Should output https://api.chuizi.ai/anthropic
- Common causes:
- Network requires a proxy -- set the
HTTPS_PROXYenvironment variable - DNS resolution issues -- try using
1.1.1.1or8.8.8.8as your DNS server - Firewall blocking -- ensure HTTPS outbound to
api.chuizi.aiis allowed
- Network requires a proxy -- set the
Prompt Caching Not Working
Symptom: Costs are not reduced as expected, no cache_read_input_tokens visible in the dashboard.
Steps to resolve:
- Confirm you're using the
/anthropicendpoint:
terminal
bash
echo $ANTHROPIC_BASE_URL # Must be https://api.chuizi.ai/anthropic # If set to https://api.chuizi.ai/v1, caching behavior differs
-
Check the request log in the dashboard for these usage fields:
cache_creation_input_tokens-- tokens written to cache on first requestcache_read_input_tokens-- tokens served from cache on subsequent requests
-
Common reasons caching doesn't activate:
- System prompt is too short -- Anthropic requires at least 1024 tokens to trigger caching
- Too much time between requests -- cache expires after approximately 5 minutes
- Request prefix changes between calls -- caching requires identical prefixes across consecutive requests
Next Steps
- Configuration Guide — verify your environment variable setup
- Error Codes Reference — complete list of API error codes
- Rate Limits — understand rate limiting behavior