JavaScript/TypeScript SDK
Install the Anthropic SDK:Using Different Claude Models
Switch between different Claude models:Vision Capabilities
Use Claude’s vision capabilities with images:Streaming Responses
Stream responses for real-time output:Python SDK
Install the Anthropic Python SDK:Tool Use (Function Calling)
Use Claude’s tool calling capabilities:Streaming with Python
Advanced Features
Prompt Caching
Reduce costs and improve performance by caching parts of your prompts that don’t change between requests. Prompt caching allows you to mark sections of your prompt for caching, with cache writes charged at 1.25x and cache reads at 0.1x the original input price.System Messages
Use system messages to set Claude’s behavior:Multi-turn Conversations
Handle multi-turn conversations:Structured Output
Use Claude for structured data generation:Error Handling
Handle errors gracefully:Rate Limiting
Implement rate limiting and retry logic:Best Practices
1. Optimize Token Usage
2. Use Appropriate Models
3. Implement Caching
Integration Examples
Chatbot Implementation
Document Analysis
Migration from Anthropic Direct
When migrating from Anthropic’s direct API to Electron Hub:- Change the base URL to
https://api.electronhub.ai/v1 - Update your API key to use your Electron Hub key (starts with
ek-) - No code changes needed - All parameters and responses remain the same
- Access to more models - You can also use OpenAI, Google, and other models
- Unified billing - All model usage is billed through Electron Hub
- Enhanced features - Access to additional capabilities like web search
https://playground.electronhub.ai/console.