Integration & Automation#

This section covers how to integrate MassGen into your applications and automate workflows. MassGen offers multiple integration paths for different use cases.

Choosing Your Integration#

Method

Best For

Key Features

HTTP Server

API gateways, proxies, external apps

OpenAI-compatible endpoints, SSE streaming

Python API

Application integration, automation scripts

Async-first, full control, direct access

LiteLLM

Existing LiteLLM users, LangChain integration

OpenAI-compatible, drop-in replacement

Automation Mode

Background execution, CI/CD pipelines

Headless, non-interactive, scriptable

Guides in This Section#

🌐 HTTP Server

OpenAI-compatible API

  • massgen serve command

  • /v1/chat/completions endpoint

  • Streaming via SSE

  • Config-as-Authority mode

Read the HTTP Server guide →

🐍 Python API

Direct Python integration

  • massgen.run() async API

  • massgen.build_config() programmatic config

  • LiteLLM provider registration

  • Full control over execution

Read the Python API guide →

🤖 Automation

Headless execution

  • Background execution

  • CI/CD integration

  • Status file monitoring

  • Non-interactive mode

Read the Automation guide →

🔗 Framework Interoperability

External frameworks

  • AG2 framework integration

  • LangChain compatibility

  • Custom backends

  • External tools

Read the Interoperability guide →

Quick Examples#

# Start the server with a config
massgen serve --config balanced.yaml --port 4000
# Any OpenAI-compatible client works
from openai import OpenAI
client = OpenAI(base_url="http://localhost:4000/v1", api_key="unused")

response = client.chat.completions.create(
    model="massgen",  # Ignored when config is provided
    messages=[{"role": "user", "content": "Your question"}]
)
print(response.choices[0].message.content)  # Final answer
print(response.choices[0].message.reasoning_content)  # Traces