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
Chat
Conversation completion interface, supporting streaming output.
Model List
Retrieve a list of all available models on the platform.
Completions
Traditional text completion interface.
Full API Reference
Browse the complete API documentation including images, audio, embeddings, and more.
Supported Endpoint Overview
| Endpoint | Method & Path | Description |
|---|---|---|
| Chat Completions | POST /v1/chat/completions | Conversation generation, supports streaming |
| Completions | POST /v1/completions | Legacy completion endpoint |
| Embeddings | POST /v1/embeddings | Text vectorization |
| Image Generation | POST /v1/images/generations | Text-to-image |
| Image Edit | POST /v1/images/edits | Image editing |
| Audio Transcription | POST /v1/audio/transcriptions | Whisper and others |
| Text-to-Speech | POST /v1/audio/speech | TTS |
| Rerank | POST /v1/rerank | Document reranking |
| Responses API | POST /v1/responses | OpenAI Responses format |
| Realtime | GET /v1/realtime (WebSocket) | OpenAI Realtime API |
| Model List | GET /v1/models | Query available models |
How is this guide?