One OpenAI-compatible gateway in front of every major model. Use one base URL and one Miavo key, then choose the model route slug that fits your provider, region, and compliance needs.
Send your sk-maas-... key as a bearer token. Provider-side credentials stay in the Miavo pool.
POST https://api.miavo.xyz/v1/chat/completions
Authorization: Bearer sk-maas-...
Content-Type: application/jsonEvery key also has an Access Key ID and Secret Access Key, shown once when the key is created. A signed request needs no bearer token and works on every endpoint. Sign the lines below, joined with \n, using HMAC-SHA256 with the secret and hex output. The body hash is the SHA-256 of the exact bytes sent; use the hash of an empty string for GET and multipart requests. Timestamps must be within 5 minutes, and each signature is accepted once.
MAAS-HMAC-SHA256
<timestamp>
<nonce>
POST
/v1/chat/completions
<sha256 of body, hex>
x-maas-access-key-id: <access key id>
x-maas-timestamp: 2026-11-06T08:00:00.000Z
x-maas-nonce: <random string>
x-maas-signature: <hmac hex>Keys can also be limited to an IP allowlist of IPv4 or IPv6 addresses and CIDR ranges, set when the key is created.
GET /v1/models returns concrete route slugs. It only includes routes with an active upstream key mapped to that model. Coming soon routes stay visible in the public catalog but are not returned here.
curl https://api.miavo.xyz/v1/models \
-H "Authorization: Bearer sk-maas-..."Docs stay short: model-specific examples, prices, capabilities, and provider routes live on model detail pages. 76 canonical models / 76 provider routes / 46 available
| Model family | Canonical models | Available routes | Modalities |
|---|---|---|---|
| Claude | 13 | 13 | Text |
| OpenAI | 17 | 15 | Image, Text |
| Gemini | 18 | 13 | Image, Text, Video |
| Kimi | 2 | 2 | Text |
| MiniMax | 1 | 1 | Text |
| Qwen | 21 | 0 | Image, Text, Video |
| DeepSeek | 2 | 2 | Text |
| GLM | 1 | 0 | Text |
| Seedance · ByteDance | 1 | 0 | Video |
When a canonical model is available from multiple providers, append a routing suffix to let Miavo rank the eligible routes and fall back automatically.
| Mode | Model suffix | Optimizes for |
|---|---|---|
| Balanced | :balanced | Price, reliability, latency, and throughput |
| Fast | :fast | Output throughput with latency and health safeguards |
| Agent reliable | :agent | Tool support and recent route success rate |
const response = await client.chat.completions.create({
model: 'claude-opus-4-8:fast',
messages: [{ role: 'user', content: 'Summarize this document.' }],
});The response reports the concrete provider route that handled the request. To pin a request to one provider, use that route's unsuffixed model slug instead.
Paste these lines into your terminal, then start the tool in the same window.
export ANTHROPIC_BASE_URL="https://api.miavo.xyz"
export ANTHROPIC_AUTH_TOKEN="sk-maas-..."
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"claudeThese variables last for the current terminal window. Add them to your shell profile (or use setx on Windows) to keep them.
A coding agent with access to your local terminal can test the API without receiving your secret in chat. Keep the key in a temporary environment variable and let the agent report only redacted results.
Test GET https://api.miavo.xyz/v1/models with my Miavo API key.
Do not ask me to paste the key into chat. Do not write it to source code, command history, logs, screenshots, or reports.
Create a script that reads MAAS_API_KEY from the environment and ask me to enter it through a no-echo terminal prompt.
Print only the HTTP status, content-type, cf-ray, x-maas-request-id, model count, and a redacted error body.
Unset the environment variable when finished.If the AI cannot use your local terminal, run the generated script yourself and send it only the redacted output—not the key.
Set request_format to anthropic or gemini on POST /v1/chat/completions to send that provider’s native request body and receive its native JSON or SSE response. Use one matching model route from /v1/models. Omit the field for OpenAI Chat Completions.
curl https://api.miavo.xyz/v1/chat/completions \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{"request_format":"anthropic","model":"YOUR_CLAUDE_ROUTE","max_tokens":256,"messages":[{"role":"user","content":[{"type":"text","text":"Hello"}]}]}'curl https://api.miavo.xyz/v1/chat/completions \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{"request_format":"gemini","model":"YOUR_GEMINI_ROUTE","contents":[{"role":"user","parts":[{"text":"Hello"}]}],"generationConfig":{"maxOutputTokens":256}}'Besides Chat Completions, the gateway serves the official request shapes of each provider, so the OpenAI, Anthropic and Google GenAI SDKs work by changing only the base URL and key. All surfaces share routing, failover, rate limits and billing.
import anthropic
client = anthropic.Anthropic(base_url="https://api.miavo.xyz", api_key="sk-maas-...")
msg = client.messages.create(
model="claude-fable-5-1", max_tokens=4096,
thinking={"type": "enabled", "budget_tokens": 2048},
messages=[{"role": "user", "content": [
{"type": "document", "source": {"type": "base64", "media_type": "application/pdf", "data": pdf_b64}},
{"type": "text", "text": "Summarize this report"}]}])from openai import OpenAI
client = OpenAI(base_url="https://api.miavo.xyz/v1", api_key="sk-maas-...")
resp = client.responses.create(
model="gpt-6-luna", reasoning={"effort": "medium"},
input=[{"role": "user", "content": [
{"type": "input_text", "text": "What is in this image?"},
{"type": "input_image", "image_url": "https://example.com/cat.png"}]}])
print(resp.output_text)from google import genai
client = genai.Client(api_key="sk-maas-...", http_options={"base_url": "https://api.miavo.xyz"})
resp = client.models.generate_content(
model="gemini-3.1-pro", contents="Explain quantum tunneling",
config={"thinking_config": {"thinking_budget": 1024}})
print(resp.text)Beyond function tools, the gateway serves OpenAI custom (freeform) tools, the apply_patch built-in tool, Anthropic’s tool search and supplier web search, on every model. Upstreams that have a feature run it natively; other models receive an equivalent that the gateway translates back, so a client never branches on the route.
from openai import OpenAI
client = OpenAI(base_url="https://api.miavo.xyz/v1", api_key="sk-maas-...")
PATCH_GRAMMAR = r"""
start: "*** Begin Patch\n" line+ "*** End Patch\n"
line: /[^\n]*\n/
"""
resp = client.responses.create(
model="gpt-6-codex",
input="Rename the helper in src/util.ts to parseId",
tools=[{"type": "custom", "name": "apply_patch",
"description": "Edit files with a V4A patch",
"format": {"type": "grammar", "syntax": "lark", "definition": PATCH_GRAMMAR}}])
call = next(item for item in resp.output if item.type == "custom_tool_call")
print(call.input) # raw patch text; reply with {"type": "custom_tool_call_output", "call_id": call.call_id, "output": "Done"}curl https://api.miavo.xyz/v1/responses \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{"model":"claude-opus-5-5","tools":[{"type":"apply_patch"}],"input":"Create hello.py that prints hello"}'
# → output item {"type":"apply_patch_call","call_id":"...","operation":{"type":"create_file","path":"hello.py","diff":"+print(\"hello\")"}}
# Reply: {"type":"apply_patch_call_output","call_id":"...","status":"completed"}curl https://api.miavo.xyz/v1/messages \
-H "x-api-key: sk-maas-..." -H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-opus-5-5","max_tokens":1024,
"messages":[{"role":"user","content":"What is the weather in Tokyo?"}],
"tools":[{"type":"tool_search_tool_regex_20251119","name":"tool_search_tool_regex"},
{"name":"get_weather","description":"Current weather for a city","input_schema":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]},"defer_loading":true},
{"name":"search_files","description":"Search the workspace","input_schema":{"type":"object","properties":{"query":{"type":"string"}}},"defer_loading":true}]}'curl https://api.miavo.xyz/v1/responses \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6-sol","input":"What is the weather in Tokyo?",
"tools":[{"type":"tool_search"},
{"type":"function","name":"get_weather","description":"Current weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]},"defer_loading":true},
{"type":"function","name":"search_files","description":"Search the workspace","parameters":{"type":"object","properties":{"query":{"type":"string"}}},"defer_loading":true}]}'
# → output item {"type":"function_call","call_id":"...","name":"get_weather","arguments":"{\"city\":\"Tokyo\"}"}Image endpoints follow the OpenAI Images API, so the OpenAI SDK images.generate and images.edit calls work after changing the base URL and key. GPT Image and Nano Banana models share the same endpoints.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /v1/images/generations | Create images from a prompt. Reference images may be added with image or images. |
| POST | /v1/images/edits | Edit or combine input images, with an optional mask. Multipart or JSON. |
| POST | /v1/chat/completions | Call an image model through chat; images return in message.images. |
Both image endpoints return base64 images in data[].b64_json, plus size, quality, background, output_format and token usage.
Send a prompt and the output options. n controls how many images are returned in one request.
curl https://api.miavo.xyz/v1/images/generations \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.5-flare",
"prompt": "A red apple on a white table",
"n": 2,
"size": "1536x864",
"quality": "high",
"output_format": "webp",
"output_compression": 80
}'import base64
from openai import OpenAI
client = OpenAI(base_url="https://api.miavo.xyz/v1", api_key="sk-maas-...")
result = client.images.generate(
model="gpt-image-2.5-flare",
prompt="A red apple on a white table",
size="1536x864",
quality="high",
)
with open("apple.png", "wb") as f:
f.write(base64.b64decode(result.data[0].b64_json)){
"created": 1793000000,
"data": [{ "b64_json": "iVBORw0KGgo..." }],
"background": "opaque",
"output_format": "webp",
"quality": "high",
"size": "1536x864",
"usage": {
"input_tokens": 50,
"input_tokens_details": { "text_tokens": 10, "image_tokens": 40 },
"output_tokens": 4160,
"total_tokens": 4210
}
}Upload files with multipart form data, or send JSON with images[] entries. Each entry is an image_url (public https URL or base64 data URL) or a file_id from /v1/files.
curl https://api.miavo.xyz/v1/images/edits \
-H "Authorization: Bearer sk-maas-..." \
-F model=gpt-image-2 \
-F "prompt=Put both products in one gift basket" \
-F "image[][email protected]" \
-F "image[][email protected]" \
-F "[email protected]"Video generation is asynchronous. Create a task, poll it until it finishes, then download the file with the same API key.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /v1/videos | Create a task. /v1/videos/generations is an alias. |
| GET | /v1/videos/{id} | Read task status, duration and cost. |
| GET | /v1/videos/{id}/content | Download the finished MP4. |
| GET | /v1/videos/models | List video models available to your key. |
Credit is held when the task is created and settled on the actual duration or usage reported by the provider. Failed tasks are refunded in full.
The response returns immediately with the task id and status pending.
curl https://api.miavo.xyz/v1/videos \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{
"model": "wan3.0-video",
"prompt": "A paper boat drifting down a rainy street",
"duration_seconds": 8,
"resolution": "720p",
"aspect_ratio": "16:9",
"generate_audio": true
}'{
"id": "video-...",
"object": "video.generation",
"model": "wan3.0-video",
"status": "pending",
"duration_seconds": 8
}Poll every 5–10 seconds. Most tasks finish in one to several minutes depending on duration and resolution.
curl https://api.miavo.xyz/v1/videos/video-... \
-H "Authorization: Bearer sk-maas-..."{
"id": "video-...",
"object": "video.generation",
"model": "wan3.0-video",
"status": "succeeded",
"duration_seconds": 8,
"video_url": "/v1/videos/files/video-...?sample=0",
"video_urls": ["/v1/videos/files/video-...?sample=0"],
"cost_usd": 0.64,
"error": null
}Each response carries its request id in the body id and the x-maas-request-id header. Look up one request with GET /v1/generation?id=, or list requests for token reconciliation. Ranges cover at most 31 days and default to the last day.
GET /v1/usage/requests?from=2026-11-01T00:00:00Z&to=2026-11-02T00:00:00Z&model=...&status=failed&limit=1000&cursor=...
GET /v1/usage/requests?from=...&to=...&format=csv
GET /v1/usage/metrics?from=...&to=...&group_by=model&interval=hourMetrics group by model, vendor, status or api_key, and report requests, error rate, tokens, cache hit rate, cost, and P50, P95 and P99 for latency and first token.
Failed attempts move to another route automatically before any output reaches you. Send x-maas-max-attempts: 1 to lower the attempts for one request, or provider.allow_fallbacks: false to turn this off. For a persistent connection, open wss://.../v1/chat/completions/ws and send a Chat Completions body; chunks arrive as they are generated, ending with [DONE].
The same host also serves gRPC over TLS on port 443. The json field carries the Chat Completions body and responses, so every parameter works unchanged. Send the key as authorization: Bearer ... metadata, or the AK/SK headers signed for POST /v1/chat/completions over the exact json string. The method decides streaming.
syntax = "proto3";
package maas.v1;
service ChatCompletions {
rpc Create(ChatRequest) returns (ChatResponse);
rpc Stream(ChatRequest) returns (stream ChatResponse);
}
message ChatRequest { string json = 1; }
message ChatResponse { string json = 1; }All errors are OpenAI-shaped: HTTP status plus JSON body with error.code, error.message, and error.type.
{
"error": {
"code": "rate_limit_exceeded",
"type": "rate_limit",
"message": "RPM exceeded - 200 requests in 60 seconds."
}
}| Status | Code | When |
|---|---|---|
| 401 | authentication_error | Missing or invalid sk-maas key. |
| 402 | budget_exhausted | Credit balance is below the required request hold. |
| 403 | model_not_allowed | Model is not on this key allow-list. |
| 400 | invalid_request | Body failed schema validation. |
| 429 | rate_limit_exceeded | Per-key RPM or TPM tripped. |
| 502 | upstream_error | Provider returned an error after we forwarded. |
| 503 | no_upstream | No pooled credential is available for this model. |
Each API key carries its own rpmLimit and tpmLimit, both rolling 60-second windows. New keys have no platform RPM or TPM cap. A value of 0 means unlimited. Existing configured limits, account balances, budgets, and upstream provider quotas still apply.
Miavo implements the OpenAI Chat Completions schema. Any SDK that targets OpenAI works by swapping baseURL and apiKey.
- const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
+ const client = new OpenAI({
+ baseURL: 'https://api.miavo.xyz/v1',
+ apiKey: process.env.MACAW_API_KEY,
+ });
- model: 'gpt-4o-mini',
+ model: 'claude-opus-4-8'from openai import OpenAI
client = OpenAI(base_url="https://api.miavo.xyz/v1", api_key="sk-maas-...")
resp = client.responses.create(
model="claude-opus-5-5",
tools=[{"type": "web_search", "search_context_size": "medium"}],
input="What changed in the latest Node.js LTS release?")
print(resp.output_text)
for item in resp.output:
if item.type == "web_search_call": print("searched:", item.action)
for part in resp.output[-1].content:
for a in part.annotations: print(a.url, a.title)curl https://api.miavo.xyz/v1/images/edits \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.5-sunburst",
"prompt": "Turn the apple green",
"images": [
{ "image_url": "https://example.com/apple.png" },
{ "file_id": "file_..." }
],
"quality": "medium"
}'GPT Image models can stream. Set stream to true and partial_images to 0–3 to receive Server-Sent Events before the final image.
curl -N https://api.miavo.xyz/v1/images/generations \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A blue bicycle",
"stream": true,
"partial_images": 2
}'event: image_generation.partial_image
data: {"b64_json": "...", "partial_image_index": 0}
event: image_generation.completed
data: {"b64_json": "...", "usage": {...}}| Event | Meaning |
|---|---|
image_generation.partial_image | A partial image with b64_json and partial_image_index (image_edit.partial_image for edits). |
image_generation.completed | The final b64_json and usage (image_edit.completed for edits). |
Applies to both /v1/images/generations and /v1/images/edits.
| Parameter | Values | Notes |
|---|---|---|
model | gpt-image-2.5-flare · gpt-image-2.5-sunburst · gpt-image-2 | Required. |
prompt | string | Required. |
n | 1–10 | Number of images. |
size | auto · WIDTHxHEIGHT | Both sides divisible by 16, aspect ratio 1:3–3:1, at most 3840 px per edge, 655,360–8,294,400 pixels in total. |
quality | low · medium · high · auto | Default auto. gpt-image-2.5 models also accept xhigh and max. |
background | transparent · opaque · auto | transparent requires png or webp. |
output_format | png · jpeg · webp | |
output_compression | 0–100 | jpeg and webp only. |
moderation | low · auto | |
stream / partial_images | boolean / 0–3 | See Streaming. |
input_fidelity | high · low | Edits only. |
safety_identifier | string | Stable end-user identifier for abuse monitoring. |
Nano Banana models use the same two endpoints with Gemini image options. They return one image per request and do not stream.
curl https://api.miavo.xyz/v1/images/edits \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-pro",
"prompt": "Make it a night scene",
"images": [{ "image_url": "data:image/png;base64,iVBORw0KGgo..." }],
"aspect_ratio": "21:9",
"image_size": "4K"
}'| Parameter | Values | Notes |
|---|---|---|
model | nano-banana · nano-banana-2 · nano-banana-2-lite · nano-banana-pro | Required. |
aspect_ratio | 1:1 · 2:3 · 3:2 · 3:4 · 4:3 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9 | |
image_size | 512 · 1K · 2K · 4K | nano-banana-2: all four. nano-banana-pro: 1K, 2K, 4K. Others: 1K. |
size | WIDTHxHEIGHT | Mapped to the closest aspect_ratio and image_size. |
images | image_url[] | Up to 14 reference images (3 on nano-banana), 8 MB in total. |
Image models also work on POST /v1/chat/completions. Put input images in image_url parts; generated images return in choices[0].message.images (delta.images when streaming). For full Gemini control, send request_format gemini with generationConfig.imageConfig.
curl https://api.miavo.xyz/v1/chat/completions \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"messages": [{
"role": "user",
"content": [
{ "type": "text", "text": "Add a rainbow to this photo" },
{ "type": "image_url", "image_url": { "url": "https://example.com/park.jpg" } }
]
}]
}'| Status | Meaning |
|---|---|
pending | Accepted and waiting for the provider. |
running | The provider is generating the video. |
succeeded | Finished. video_url and video_urls are set; cost_usd is final. |
failed | Finished with an error in error.code and error.message. The hold is refunded. |
Download requires the same Authorization header. Use -L so redirects are followed.
curl -L https://api.miavo.xyz/v1/videos/video-.../content \
-H "Authorization: Bearer sk-maas-..." \
-o out.mp4Supported values differ per model; see the model sections below. Image fields take an object with a url (public https URL, or a base64 data URL where the model allows it).
| Parameter | Values | Notes |
|---|---|---|
model | string | Required. A video model slug from /v1/videos/models. |
prompt | string, ≤ 4000 chars | Required. |
duration_seconds | integer | Output length in seconds. |
resolution | 480p · 720p · 1080p … | |
aspect_ratio | 16:9 · 9:16 · 1:1 … | |
seed | integer | Reproducible sampling where supported. |
image | { url } | First frame. |
last_frame | { url } | Last frame. Requires image. |
reference_images | [{ url }] | Subject or style references. |
source_video | { url, duration_seconds } | Source clip for video editing. |
watermark | boolean | |
generate_audio | boolean | Generate a soundtrack where supported. |
Each HappyHorse mode is a separate model slug. 1.0 and 1.1 share the same parameters.
| model | Parameter | Notes |
|---|---|---|
happyhorse-1.x-t2v | Text to video. | |
happyhorse-1.x-i2v | image | First frame to video. The aspect ratio follows the image. |
happyhorse-1.x-r2v | reference_images | Up to 9 references. Refer to them as [Image 1], [Image 2] … in the prompt. |
happyhorse-1.0-video-edit | source_video | Edit a 3–60 s clip with up to 5 reference_images. The hold covers input plus output seconds. |
| Parameter | Values | Notes |
|---|---|---|
resolution | 480p · 720p · 1080p | Video edit: 720p or 1080p. |
aspect_ratio | 16:9 · 9:16 · 1:1 · 4:3 · 3:4 · 4:5 · 5:4 · 9:21 · 21:9 | Ignored for i2v and video edit, which follow the input. |
duration_seconds | 3–15 | |
audio_setting | auto · origin | Video edit only. origin keeps the source audio. |
watermark | boolean | |
seed | integer |
curl https://api.miavo.xyz/v1/videos \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{
"model": "happyhorse-1.1-r2v",
"prompt": "[Image 1] walks a dog through [Image 2] at sunset",
"reference_images": [
{ "url": "https://example.com/person.png" },
{ "url": "https://example.com/park.png" }
],
"resolution": "1080p",
"aspect_ratio": "9:16",
"duration_seconds": 5
}'wan3.0-video picks its mode from the fields you send.
| Purpose | Parameter | Notes |
|---|---|---|
| Text to video | prompt | No image fields. |
| First / last frame | image, last_frame | last_frame is optional. |
| References | reference_images, reference_videos, reference_audios, file, link | Up to 10 images, 5 videos ({ url, duration_seconds }, 15 s in total), 5 audio clips, and one file or link. |
| Parameter | Values | Notes |
|---|---|---|
resolution | 480p · 720p · 1080p | |
aspect_ratio | adaptive · 21:9 · 16:9 · 4:3 · 1:1 · 3:4 · 9:16 | Default adaptive. |
duration_seconds | 2–30 | Reference video length plus duration must not exceed 30 s. |
generate_audio | boolean | |
prompt_extend | boolean | Let the model rewrite the prompt. |
watermark | boolean | |
seed | integer |
First / last frame cannot be combined with references.
curl https://api.miavo.xyz/v1/videos \
-H "Authorization: Bearer sk-maas-..." \
-H "Content-Type: application/json" \
-d '{
"model": "wan3.0-video",
"prompt": "The flower blooms in time-lapse",
"image": { "url": "https://example.com/bud.png" },
"last_frame": { "url": "https://example.com/bloom.png" },
"duration_seconds": 6
}'doubao-seedance-2-0-260128 supports text to video.
| Parameter | Values | Notes |
|---|---|---|
duration_seconds | 4–15 | |
resolution | 480p · 720p · 1080p | |
aspect_ratio | 16:9 · 9:16 · 1:1 · 4:3 · 3:4 |