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

JavaScript/Node.js SDK

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

Using Different Models

Switch between any supported model:

Image Generation

Embeddings

Speech-to-Text

See Speech-to-Text for formats, caps, and models.

Moderations

Check content for policy violations using text and image moderation:

Python SDK

Install the OpenAI Python SDK:
Configure it for Electron Hub:

Streaming Responses

Function Calling

Speech-to-Text

Moderations

Go SDK

Advanced Features

Model Selection

Electron Hub provides access to models from multiple providers:

Error Handling

Best Practices

  1. Always handle errors - API calls can fail for various reasons
  2. Use appropriate timeouts - Set reasonable timeouts for your requests
  3. Implement rate limiting - Respect rate limits to avoid throttling
  4. Cache responses - Cache responses when appropriate to reduce costs
  5. Monitor usage - Keep track of your token usage and costs
Handle rate limits gracefully:

Migration Notes

When migrating from OpenAI directly 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 endpoints and parameters remain the same
  4. Access to more models - You can now use Claude, Gemini, and other models
  5. Unified billing - All model usage is billed through Electron Hub