Skip to main content
Mixpeek provides auto-generated SDKs that are always in sync with our latest API features.

Official SDKs

Choose the SDK that matches your development environment:

Python SDK

Full-featured Python SDK with type hints and comprehensive error handling

JavaScript SDK

TypeScript-first SDK for Node.js and browser environments

Quick Comparison

FeaturePython SDKJavaScript SDK
Package Managerpipnpm/yarn/pnpm
Type SafetyType hintsFull TypeScript
Async Support✅ (Promise-based)
Auto-generated
Runtime Validation✅ (Zod schemas)

Installation

pip install mixpeek

Quick Start Examples

Python

import mixpeek
from mixpeek.rest import ApiException

configuration = mixpeek.Configuration(host="https://api.mixpeek.com")

with mixpeek.ApiClient(configuration) as api_client:
    collections_api = mixpeek.CollectionsApi(api_client)
    collections = collections_api.list_collections(
        authorization="Bearer sk_xxxxxxxxxxxxx",
        x_namespace="ns_xxxxxxxxxxxxx"
    )
View full Python SDK documentation →

JavaScript/TypeScript

import { Mixpeek } from 'mixpeek';

const client = new Mixpeek({
  apiKey: process.env.MIXPEEK_API_KEY,
  namespace: 'my-namespace'
});

const collections = await client.collections.listCollections();
View full JavaScript SDK documentation →

Using the REST API Directly

If you prefer to use the REST API without an SDK, you can make direct HTTP requests:
import requests

# Create a namespace
response = requests.post(
    "https://api.mixpeek.com/v1/namespaces",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json={
        "namespace_name": "my-workspace",
        "description": "Production workspace"
    }
)

namespace = response.json()
print(f"Created namespace: {namespace['namespace_id']}")

Example: Direct API with Python

import requests
from typing import Optional

class MixpeekClient:
    def __init__(self, api_key: str, base_url: str = "https://api.mixpeek.com"):
        self.api_key = api_key
        self.base_url = base_url
        self.headers = {
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json"
        }

    def create_collection(
        self,
        namespace_id: str,
        collection_name: str,
        feature_extractors: list
    ) -> dict:
        """Create a new collection with feature extractors."""
        response = requests.post(
            f"{self.base_url}/v1/collections",
            headers={**self.headers, "X-Namespace-Id": namespace_id},
            json={
                "collection_name": collection_name,
                "feature_extractors": feature_extractors
            }
        )
        response.raise_for_status()
        return response.json()

    def execute_retriever(
        self,
        namespace_id: str,
        retriever_id: str,
        inputs: dict,
        limit: Optional[int] = None
    ) -> dict:
        """Execute a retriever to search documents."""
        params = {"limit": limit} if limit else {}
        response = requests.post(
            f"{self.base_url}/v1/retrievers/{retriever_id}/execute",
            headers={**self.headers, "X-Namespace-Id": namespace_id},
            json={"inputs": inputs},
            params=params
        )
        response.raise_for_status()
        return response.json()

# Usage
client = MixpeekClient(api_key="sk_...")

# Create a collection
collection = client.create_collection(
    namespace_id="ns_abc123",
    collection_name="videos",
    feature_extractors=[{
        "feature_extractor_name": "multimodal_extractor",
        "version": "v1"
    }]
)

# Execute a search
results = client.execute_retriever(
    namespace_id="ns_abc123",
    retriever_id="ret_xyz789",
    inputs={"query": "machine learning"},
    limit=10
)

Example: Direct API with JavaScript

class MixpeekClient {
  constructor(apiKey, baseUrl = "https://api.mixpeek.com") {
    this.apiKey = apiKey;
    this.baseUrl = baseUrl;
    this.headers = {
      "Authorization": `Bearer ${apiKey}`,
      "Content-Type": "application/json"
    };
  }

  async createCollection(namespaceId, collectionName, featureExtractors) {
    const response = await fetch(`${this.baseUrl}/v1/collections`, {
      method: "POST",
      headers: {
        ...this.headers,
        "X-Namespace-Id": namespaceId
      },
      body: JSON.stringify({
        collection_name: collectionName,
        feature_extractors: featureExtractors
      })
    });

    if (!response.ok) {
      throw new Error(`API error: ${response.statusText}`);
    }

    return response.json();
  }

  async executeRetriever(namespaceId, retrieverId, inputs, limit = null) {
    const url = new URL(`${this.baseUrl}/v1/retrievers/${retrieverId}/execute`);
    if (limit) url.searchParams.set("limit", limit);

    const response = await fetch(url, {
      method: "POST",
      headers: {
        ...this.headers,
        "X-Namespace-Id": namespaceId
      },
      body: JSON.stringify({ inputs })
    });

    if (!response.ok) {
      throw new Error(`API error: ${response.statusText}`);
    }

    return response.json();
  }
}

// Usage
const client = new MixpeekClient("sk_...");

// Create a collection
const collection = await client.createCollection(
  "ns_abc123",
  "videos",
  [{
    feature_extractor_name: "multimodal_extractor",
    version: "v1"
  }]
);

// Execute a search
const results = await client.executeRetriever(
  "ns_abc123",
  "ret_xyz789",
  { query: "machine learning" },
  10
);

Next Steps

Python SDK

Full Python SDK documentation

JavaScript SDK

Full JavaScript SDK documentation

API Reference

Explore all API endpoints

MCP Server

Use Mixpeek with AI assistants

Quickstart

Get started with Mixpeek

Examples

View example implementations