Unified Model Access
Introduction
To enhance user experience and simplify the API calling process, the MaaS API has introduced a significant feature that supports multiple models sharing the same domain name for access. This feature aims to streamline the integration and management of multiple models for users, reducing the complexity of domain name configurations.
In traditional calling methods, each model requires a separate domain name for access. While this provides clear model distinctions, in scenarios involving multiple models, users need to maintain several domain names, increasing the complexity of management and configuration. To address this issue, the MaaS API now allows users to access multiple models through a shared domain name. This approach not only simplifies domain name management but also enhances the flexibility and efficiency of API calls.
At the same time, to accommodate existing users' habits and ensure system stability, we have retained the original calling method, where each model uses an independent domain name for access. Both methods are compatible, allowing users to choose the most suitable calling method based on their needs.
We also provide detailed guidance on best practices for the new method, helping users quickly get started and fully leverage the advantages of multi-domain integration.
Best Practices
Get Model List
curl --location 'https://genaiapi.cloudsway.net/v1/models' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY'
The above operation will return a list of all models owned by the AK account. For a specific model, an API request can be made.
{
"data": [
{
"id": "MaaS 1.5 Pro",
"created": "1720089491",
"object": "model",
"owned_by": "system"
},
{
"id": "MaaS 3 Haiku",
"created": "1720514922",
"object": "model",
"owned_by": "system"
},
{
"id": "MaaS 3 Opus",
"created": "1720514934",
"object": "model",
"owned_by": "system"
},
{
"id": "MaaS ASpeech",
"created": "1723607825",
"object": "model",
"owned_by": "system"
}
],
"object": "list"
}
Text to Text
The value of the model field must be consistent with the value in the returned model list.
curl --location 'https://genaiapi.cloudsway.net/v1/chat/completions' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--header 'Content-Type: application/json' \
--data '{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "hi"
}
]
}
],
"model":"MaaS 4o mini", // When calling via an endpoint, the endpoint locks the model; changing the model parameter has no effect.
"stream": false,
"stream_options":{"include_usage":true}
}'
multimodal
curl --request POST \
--url https://genaiapi.cloudsway.net/v1/chat/completions \
--header 'Accept: */*' \
--header 'Accept-Encoding: gzip, deflate, br' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'User-Agent: PostmanRuntime-ApipostRuntime/1.1.0' \
--data '{
"messages": [
{
"role": "system",
"content": "Assume you are a food expert. You need to analyze the ingredients and calories from the provided image and return the result in JSON format"
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Analyze this"
},
{
"type": "image_url",
"image_url": {
"url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSqbvh1y4Kc3bOG60cNFQ1HRIYeMyg5hYhKNQ&s"
}
}
]
}
],
"model":"MaaS_2.5_pro_20250605", // When calling via an endpoint, the endpoint locks the model; changing the model parameter has no effect.
"stream": true,
"stream_options": {
"include_usage": true
}
}'
Embedding
curl --location 'https://genaiapi.cloudsway.net/v1/embeddings' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--header 'Content-Type: application/json' \
--data '{
"input":"hi",
"model":"MaaS Embedding-3-large" // When calling via an endpoint, the endpoint locks the model; changing the model parameter has no effect.
}'
Text to Image
MaaS Dall-e-3
curl --location 'https://genaiapi.cloudsway.net/v1/images/generations' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "A cute cat sitting on a windowsill, watching the birds outside",
"model": "MaaS Dall-E-3", // When calling via an endpoint, the endpoint locks the model; changing the model parameter has no effect.
"n": 1,
"quality": "hd",
"response_format": "url",
"size": "1024x1024",
"style": "vivid",
"user": "god"
}'
MaaS_image_1
Generate images.
curl --location 'https://genaiapi.cloudsway.net/v1/images/generations' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A monkey",
"size": "1024x1536",
"quality": "low",
"output_compression": 30,
"output_format": "jpeg",
"n": 1,
"model": "MaaS_image_1" // When calling via an endpoint, the endpoint locks the model; changing the model parameter has no effect.
}'
Edit images.
curl --location 'https://genaiapi.cloudsway.net/v1/images/edits' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--form 'image=@"/C:/Users/pic/monkey_king.png"' \
--form 'image=@"/C:/Users/pic/king_kong.webp"' \
--form 'prompt="Merge into one"' \
--form 'model="MaaS_image_1"'
MaaS-Flux-1-schnell
Generate images.
curl --location --request POST 'https://genaiapi.cloudsway.net/v2/images/generations' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-raw '{
"prompts": "A beautiful and youthful high school girl is sitting in the classroom, with a bright smile on her face.",
"aspect_ratio": "1:1",
"step": 4,
"model":"MaaS-Flux-1-schnell" // When calling via an endpoint, the endpoint locks the model; changing the model parameter has no effect.
}'
View the results based on the task ID.
curl --location --request GET 'https://genaiapi.cloudsway.net/v2/images/tasks/MaaS-Flux-1-schnell/17d1fbcf-0a05-428f-a33a-bcca22871c94' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-raw ''