Anthropic SDK
The Anthropic SDK is the official library for interacting with Claude in your applications. By routing SDK requests through Shinzo, you gain visibility into your AI usage patterns, token consumption, response times, and costs.How It Works
Shinzo acts as a transparent proxy between your application and the Anthropic API. When you configure the Anthropic SDK to use Shinzo:- Your requests are sent to Shinzo instead of directly to Anthropic
- Shinzo authenticates your request using your Shinzo API key
- The request is forwarded to Anthropic with your stored Anthropic credentials
- Analytics are recorded (tokens, latency, errors, etc.)
- The response is returned to your application
Prerequisites
Before configuring the Anthropic SDK with Shinzo, you need:- A Shinzo account - Sign up at app.shinzo.ai
- Your Anthropic API key stored in Shinzo - Add it in Settings > API Keys > Provider Keys
- A Shinzo API key - Create one in Settings > API Keys > Shinzo Keys
Configuration Methods
Shinzo supports two methods for configuring the Anthropic SDK. Both methods use your Shinzo API key in place of your Anthropic key.- Constructor Parameters (Recommended)
- Environment Variables
Method 1: Constructor Parameters
Pass the configuration directly to the SDK constructor. This is the recommended approach as it keeps configuration explicit and portable.Add your Anthropic API key to Shinzo
- Go to app.shinzo.ai
- Navigate to Settings > API Keys
- Click the Provider Keys tab
- Click Add Provider Key
- Select Anthropic as the provider
- Paste your Anthropic API key and add a label
- Click Save
Your key will be validated and encrypted before storage.
Create a Shinzo API key
- In the API Keys page, click the Shinzo Keys tab
- Click Create Key
- Give your key a descriptive name (e.g., “Production App”)
- Copy the generated key (you won’t see it again)
Verify the configuration
Run your application and make a test request. Then check the Shinzo Dashboard to see your request logged.
If your request appears in the dashboard, you’re all set.
- Configuration is explicit and self-documenting
- Easy to use different keys for different environments
- Works well with dependency injection and testing
- No environment variable conflicts
Comparison of Methods
| Feature | Constructor Parameters | Environment Variables |
|---|---|---|
| Configuration location | In code | External to code |
| Best for | Explicit configuration, testing | Containerized deployments, CI/CD |
| Multiple environments | Pass different values | Different env vars per environment |
| Code readability | Self-documenting | Requires checking environment |
Troubleshooting
Requests not appearing in dashboard
Requests not appearing in dashboard
- Verify your configuration is correct:
- Check that
baseURL/ANTHROPIC_BASE_URLis set tohttps://api.app.shinzo.ai/spotlight/anthropic - Check that
apiKey/ANTHROPIC_API_KEYcontains your Shinzo API key (not your Anthropic key)
- Check that
- Ensure the Shinzo API key is valid and not revoked
- Verify you have a provider key configured in Shinzo (Settings > API Keys > Provider Keys)
Authentication errors
Authentication errors
- 401 Unauthorized: Your Shinzo API key is invalid or revoked
- 403 Forbidden - Subscription not supported: You are attempting to use a Claude subscription OAuth token. Shinzo requires your own Anthropic API key from the Anthropic Console.
- 403 Forbidden - Invalid key: Your Anthropic key (stored in Shinzo) may be invalid or expired. Update it in Settings > API Keys > Provider Keys.
Connection timeouts
Connection timeouts
- Verify you can reach
api.app.shinzo.ai: - Check your network/firewall settings
- If using a corporate proxy, ensure it allows HTTPS connections to Shinzo

