SDKs & Integrations

Python SDK

The official Python SDK provides full API coverage with sync and async clients.
pip install modelbeam-python-sdk
Requirements: Python 3.9+ Source: github.com/modelbeam-ai/modelbeam-python-sdk

Features

  • Full API coverage (images, video, audio, TTS, voice cloning, music, transcription, embeddings, OCR, prompt enhancement)
  • Sync and async clients (ModelBeamClient / AsyncModelBeamClient)
  • Automatic job polling with exponential backoff (.wait())
  • Auto-retry on rate limits (429) and server errors (5xx)
  • Type-safe with Pydantic v2
  • Webhook signature verification
  • Price calculation for every method

Quick Example

from modelbeam import ModelBeamClient

client = ModelBeamClient(api_key="sk-your-api-key")

# Generate an image
job = client.images.generate(
    prompt="a cat floating in a nebula, photorealistic",
    model="Flux_2_Klein_4B_BF16",
    width=1024,
    height=1024,
    steps=4,
    seed=-1,
)

# Wait for the result (polls with exponential backoff)
result = job.wait()
print(result.result_url)

MCP Server

ModelBeam provides an MCP (Model Context Protocol) server for integration with AI assistants like Claude, ChatGPT, and Cursor.
  • MCP URL: https://mcp.modelbeam.ai/mcp
  • Transport: Streamed HTTP
  • Auth: OAuth 2.0 or Bearer token
See the MCP Server integration guide for setup instructions.

REST API

The REST API works with any HTTP client in any language. See the API Reference for full documentation.
curl -X POST https://api.modelbeam.ai/api/v1/client/txt2img \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"prompt": "hello world", "model": "Flux1schnell", "width": 768, "height": 768, "steps": 4, "guidance": 1, "seed": -1}'