indoxhub
A unified client for various AI providers, including OpenAI, anthropic, Google, and Mistral.
Features
- Unified API: Access multiple AI providers through a single API
- Simple Interface: Easy-to-use methods for chat, completion, embeddings, image generation, and text-to-speech
- Resemble AI: Full TTS, STT, deepfake detection, watermarking, voice cloning, and agents via
client.resemble.* - Error Handling: Standardized error handling across providers
- Authentication: Secure cookie-based authentication
- BYOK Support: Bring Your Own Key support for using your own provider API keys
Installation
pip install indoxhub
Usage
Initialization
from indoxhub import Client
# Initialize with API key
client = Client(api_key="your_api_key")
# Using environment variables
# Set INDOX_ROUTER_API_KEY environment variable
import os
os.environ["INDOX_ROUTER_API_KEY"] = "your_api_key"
client = Client()
Authentication
indoxhub uses cookie-based authentication with JWT tokens. The client handles this automatically by:
- Taking your API key and exchanging it for JWT tokens using the server's authentication endpoints
- Storing the JWT tokens in cookies
- Using the cookies for subsequent requests
- Automatically refreshing tokens when they expire
# Authentication is handled automatically when creating the client
client = Client(api_key="your_api_key")
Chat Completions
response = client.chat(
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me a joke."}
],
model="openai/gpt-4o-mini", # Provider/model format
temperature=0.7
)
print(response["data"])
Text Completions
response = client.completion(
prompt="Once upon a time,",
model="openai/gpt-4o-mini",
max_tokens=100
)
print(response["data"])
Embeddings
response = client.embeddings(
text=["Hello world", "AI is amazing"],
model="openai/text-embedding-3-small"
)
print(f"Dimensions: {len(response['data'][0]['embedding'])}")
print(f"First embedding: {response['data'][0]['embedding'][:5]}...")
Image Generation
# OpenAI Image Generation
response = client.images(
prompt="A serene landscape with mountains and a lake",
model="openai/dall-e-3",
size="1024x1024",
quality="standard", # Options: standard, hd
style="vivid" # Options: vivid, natural
)
print(f"Image URL: {response['data'][0]['url']}")
# Access base64 encoded image data
if "b64_json" in response["data"][0]:
b64_data = response["data"][0]["b64_json"]
# Use the base64 data (e.g., to display in HTML or save to file)
Resemble AI
A dedicated namespace at client.resemble.* covers Resemble's full surface — TTS, STT, deepfake detection, watermarking, voice cloning, agents, and more.
# List voices (free)
voices = client.resemble.tts.list_voices(page=1, page_size=10)
# Synthesize speech
result = client.resemble.tts.synthesize(
voice_uuid=voices["items"][0]["uuid"],
text="Hello from IndoxHub.",
output_format="mp3",
)
import base64
audio_bytes = base64.b64decode(result["audio_content"])
print(f"{result['audio_duration']:.2f}s, billed ${result['billing']['charged']}")
See the IndoxHub docs for the full Resemble API reference, error handling, and per-capability examples.
BYOK (Bring Your Own Key) Support
indoxhub supports BYOK, allowing you to use your own API keys for AI providers:
# Use your own OpenAI API key
response = client.chat(
messages=[{"role": "user", "content": "Hello!"}],
model="openai/gpt-4",
byok_api_key="sk-your-openai-key-here"
)
# Use your own Google API key for image generation
response = client.images(
prompt="A beautiful sunset",
model="google/imagen-3.0-generate-002",
aspect_ratio="16:9",
byok_api_key="your-google-api-key-here"
)
BYOK Benefits:
- No credit deduction from your indoxhub account
- No platform rate limiting
- Direct provider access with your own API keys
- Cost control - pay providers directly at their rates
Text-to-Speech
# Generate audio from text
response = client.text_to_speech(
input="Hello, welcome to indoxhub!",
model="openai/tts-1",
voice="alloy", # Options: alloy, echo, fable, onyx, nova, shimmer
response_format="mp3", # Options: mp3, opus, aac, flac
speed=1.0 # Range: 0.25 to 4.0
)
print(f"Audio generated successfully: {response['success']}")
print(f"Audio data available: {'data' in response}")
Streaming Responses
for chunk in client.chat(
messages=[{"role": "user", "content": "Write a short story."}],
model="openai/gpt-4o-mini",
stream=True
):
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Getting Available Models
# Get all providers and models
providers = client.models()
for provider in providers:
print(f"Provider: {provider['name']}")
for model in provider["models"]:
print(f" - {model['id']}: {model['description'] or ''}")
# Get models for a specific provider
openai_provider = client.models("openai")
print(f"OpenAI models: {[m['id'] for m in openai_provider['models']]}")
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for indoxhub 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| indoxhub-0.2.2.tar.gz | 43.8 kB | Without provenance | Details for indoxhub-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| indoxhub-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for indoxhub-0.2.2-py3-none-any.whl |
Total release size: 84.5 kB
Release files / indoxhub-0.2.2.tar.gz
| Download URL | indoxhub-0.2.2.tar.gz |
|---|---|
| Size | 43.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d0741cd0439c6c8876d25402234d5a35950bbbaa17420c78e2116d7c4de5f2e
|
|
BLAKE2b-256 checksum How to use checksums |
fdce616795de5d862d40f4f85e49d42d2dbeb682437fe9a1aa92d63060931935
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / indoxhub-0.2.2-py3-none-any.whl
| Download URL | indoxhub-0.2.2-py3-none-any.whl |
|---|---|
| Size | 40.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea9a59c35101eb5dc21550bc2dfab7d4c7dd52d85dffdb8ba016fb9b4f50966f
|
|
BLAKE2b-256 checksum How to use checksums |
66e88cbaf23d0440e42cfba1c9585a4b58b3230846dc1bb03bf3476ce3f2498f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for indoxhub 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.