Skip to main content
Use Electron Hub with the official Anthropic SDKs by simply changing the base URL. This allows you to access Claude models and 450+ other AI models through familiar Anthropic interfaces.

Claude Code

Base URL is the host only (Claude Code appends /v1/messages). Coding Plan keys require :dev model IDs.

JavaScript/TypeScript SDK

Install the Anthropic SDK:
Configure it to use Electron Hub:

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:
Configure it for Electron Hub:

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.

Prompt Caching Guide

Learn how to use prompt caching with Anthropic Claude models, including examples for system and user message caching.

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:
  1. Change the base URL to https://api.electronhub.ai/v1
  2. Update your API key to use your Electron Hub key (starts with ek-)
  3. No code changes needed - All parameters and responses remain the same
  4. Access to more models - You can also use OpenAI, Google, and other models
  5. Unified billing - All model usage is billed through Electron Hub
  6. Enhanced features - Access to additional capabilities like web search
Monitor your usage through the Electron Hub dashboard at https://app.electronhub.ai.