TypeScript SDK
Introduction
The Mixedbread TypeScript SDK provides type-safe access to our API with full IntelliSense support, built-in error handling, and modern JavaScript features.
Requirements: Node.js 16+ and TypeScript 4.5+ recommended for the best experience.
Installation
Quick Start
Get started with a simple example:
Configuration
The Mixedbread
constructor accepts the following options:
apiKey
: Your Mixedbread API key (required)maxRetries
: Maximum number of retries for failed requests (default: 3)timeout
: Request timeout in milliseconds (default: 30000)baseURL
: Custom base URL for API requests (default: https://api.mixedbread.com)
Error Handling
Use try/catch blocks to handle errors:
Available Services
The SDK provides type-safe access to all Mixedbread API endpoints:
Service | Description | Example Usage |
---|---|---|
mxbai.embed() | Generate text embeddings | await mxbai.embed({ model: "...", input: ["text"] }) |
mxbai.rerank() | Rerank document lists | await mxbai.rerank({ query: "...", documents: [...] }) |
mxbai.vectorStores | Manage vector stores | await mxbai.vectorStores.create({ name: "..." }) |
mxbai.vectorStores.files | Manage store files | await mxbai.vectorStores.files.create(id, { ... }) |
mxbai.files | Upload and manage files | await mxbai.files.create({ file: stream }) |
mxbai.parsing.jobs | Parse documents | await mxbai.parsing.jobs.create({ file_id: "..." }) |
Environment Setup
Using Environment Variables
Framework Integration
Resources
Documentation
- API Reference - Complete endpoint documentation
- GitHub Repository - Source code and examples
- npm 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 TypeScript! 🔷🍞
Last updated: June 11, 2025