Python SDK
Introduction
The Mixedbread Python SDK provides a convenient interface for accessing our API with built-in error handling, retries, and type safety.
Requirements: Python 3.8+ required. For older versions, consider using our REST API directly.
Installation
Install the SDK using pip:
For development with the latest features:
Quick Start
Get started with a simple example:
Configuration
The Mixedbread
constructor accepts the following parameters:
api_key
: Your Mixedbread API key (required)max_retries
: Maximum number of retries for failed requests (default: 3)timeout
: Request timeout in seconds (default: 30.0)base_url
: Custom base URL for API requests (default: https://api.mixedbread.com)
Async Support
For async applications, use the async client:
Error Handling
Use try/except blocks to handle errors:
Available Services
The SDK provides access to all Mixedbread API endpoints:
Service | Description | Example Usage |
---|---|---|
mxbai.embed() | Generate text embeddings | mxbai.embed(model="...", input=["text"]) |
mxbai.rerank() | Rerank document lists | mxbai.rerank(query="...", documents=[...]) |
mxbai.vector_stores | Manage vector stores | mxbai.vector_stores.create(name="...") |
mxbai.vector_stores.files | Manage store files | mxbai.vector_stores.files.create(...) |
mxbai.files | Upload and manage files | mxbai.files.create(file=file_obj) |
mxbai.parsing.jobs | Parse documents | mxbai.parsing.jobs.create(file_id="...") |
Environment Setup
Using Environment Variables
Resources
Documentation
- API Reference - Complete endpoint documentation
- GitHub Repository - Source code and examples
- PyPI Package - Package details and release notes
Support
- Discord Community - Get help and share projects
- GitHub Issues - Report bugs and request features
- API Dashboard - Manage your API keys and usage
Happy building with Python! 🐍🍞
SDKs
Access Mixedbread's API with our easy-to-use SDKs for Python and TypeScript.
TypeScript SDK
Learn how to install and configure Mixedbread's TypeScript SDK for interacting with our API services.
Last updated: June 11, 2025