MaasUnionMaasUnion
API Reference

API Quick Start

Get started with the MaasUnion API in minutes

Get Started in 3 Steps

MaasUnion provides an OpenAI-compatible API. You can integrate it into your application in just a few minutes.

1. Get Your API Key

Log in to the MaasUnion console, go to Tokens in the left sidebar, click Create Token, and copy the generated key. Treat this key like a password — do not share it or commit it to source control.

2. Find Your API Base URL

The base URL is shown on the platform homepage. Use it in place of OpenAI's https://api.openai.com/v1.

3. Make Your First Call

Replace OpenAI's base_url and use the MaasUnion-issued token as api_key — that's it, you can start calling.

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    api_key="sk-xxxxxxxxxxxxxxxx",
    base_url="https://www.maasunion.com/v1",
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

cURL (Claude Native Format)

curl https://www.maasunion.com/v1/messages \
  -H "x-api-key: sk-xxxxxxxx" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Explore the API

Supported Endpoint Overview

EndpointMethod & PathDescription
Chat CompletionsPOST /v1/chat/completionsConversation generation, supports streaming
CompletionsPOST /v1/completionsLegacy completion endpoint
EmbeddingsPOST /v1/embeddingsText vectorization
Image GenerationPOST /v1/images/generationsText-to-image
Image EditPOST /v1/images/editsImage editing
Audio TranscriptionPOST /v1/audio/transcriptionsWhisper and others
Text-to-SpeechPOST /v1/audio/speechTTS
RerankPOST /v1/rerankDocument reranking
Responses APIPOST /v1/responsesOpenAI Responses format
RealtimeGET /v1/realtime (WebSocket)OpenAI Realtime API
Model ListGET /v1/modelsQuery available models

How is this guide?