User Guide

Up and running in three minutes: get an API Key → make your first request

Step 1: Get an API Key

Create a key (sk- prefix) at the API Key console. All requests authenticate via:

Authorization: Bearer YOUR_API_KEY

Step 2: First chat request

The platform is fully OpenAI-compatible — point your existing SDK at https://api.maitoken.com/v1:

curl -X POST https://api.maitoken.com/v1/chat/completions \  -H "Authorization: Bearer YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-5.6-sol",    "messages": [{ "role": "user", "content": "Hello, introduce yourself" }]  }'

Available models come from List Models. Native Anthropic / Gemini protocols are also supported — see the Messages API.

Generate an image (synchronous)

Image generation is synchronous — the response carries the image directly, no polling (keep the client timeout ≥ 180 seconds):

curl -X POST https://api.maitoken.com/v1/images/generations \  -H "Authorization: Bearer YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-image-1",    "prompt": "Cyberpunk city at night after rain",    "size": "1024x1024"  }'

See Image Generation.

Generate a video (asynchronous)

Video generation is asynchronous: submit for a task Id, poll to a terminal state, then fetch the result. Sora example:

# 1. Submitcurl -X POST https://api.maitoken.com/v1/videos \  -H "Authorization: Bearer YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{ "model": "sora-2", "prompt": "Sunset over the ocean", "seconds": "8" }' # 2. Poll (every 5-10s until status=completed)curl https://api.maitoken.com/v1/videos/{video_id} \  -H "Authorization: Bearer YOUR_API_KEY" # 3. Downloadcurl https://api.maitoken.com/v1/videos/{video_id}/content \  -H "Authorization: Bearer YOUR_API_KEY" --output video.mp4

Each video vendor keeps its native protocol and entry point: Sora / Kling / Seedance.

Next steps