Skip to main content

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:
  1. Your requests are sent to Shinzo instead of directly to Anthropic
  2. Shinzo authenticates your request using your Shinzo API key
  3. The request is forwarded to Anthropic with your stored Anthropic credentials
  4. Analytics are recorded (tokens, latency, errors, etc.)
  5. The response is returned to your application

Prerequisites

Before configuring the Anthropic SDK with Shinzo, you need:
  1. A Shinzo account - Sign up at app.shinzo.ai
  2. Your Anthropic API key stored in Shinzo - Add it in Settings > API Keys > Provider Keys
  3. A Shinzo API key - Create one in Settings > API Keys > Shinzo Keys
Subscription-based access is not supported. Shinzo requires your own Anthropic API key from the Anthropic Console. OAuth tokens from Claude subscriptions (e.g., Claude Pro/Team subscriptions) cannot be used with Shinzo.

Configuration Methods

Shinzo supports two methods for configuring the Anthropic SDK. Both methods use your Shinzo API key in place of your Anthropic key.

Comparison of Methods

FeatureConstructor ParametersEnvironment Variables
Configuration locationIn codeExternal to code
Best forExplicit configuration, testingContainerized deployments, CI/CD
Multiple environmentsPass different valuesDifferent env vars per environment
Code readabilitySelf-documentingRequires checking environment

Troubleshooting

  1. Verify your configuration is correct:
    • Check that baseURL / ANTHROPIC_BASE_URL is set to https://api.app.shinzo.ai/spotlight/anthropic
    • Check that apiKey / ANTHROPIC_API_KEY contains your Shinzo API key (not your Anthropic key)
  2. Ensure the Shinzo API key is valid and not revoked
  3. Verify you have a provider key configured in Shinzo (Settings > API Keys > Provider Keys)
  • 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.
  1. Verify you can reach api.app.shinzo.ai:
    curl -I https://api.app.shinzo.ai/health
    
  2. Check your network/firewall settings
  3. If using a corporate proxy, ensure it allows HTTPS connections to Shinzo

Next Steps