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",
"stream": false,
"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"
}'
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": "一只可爱的猫咪坐在窗台上,看着外面的鸟",
"model": "MaaS Dall-E-3",
"n": 1,
"quality": "hd",
"response_format": "url",
"size": "1024x1024",
"style": "vivid",
"user": "god"
}'
MaaS-Flux-1-schnell
Invoke using the endpoint method.
curl --request POST \
--url https://genaiapi.cloudsway.net/v2/ai/lXynAhfbOC/images/generations \
--header 'Accept: */*' \
--header 'Accept-Encoding: gzip, deflate, br' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY' \
--header 'Connection: keep-alive' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'content-type: application/json' \
--data '{
"prompts": "A beautiful and youthful high school girl is sitting in the classroom, with a bright smile on her face.",
"aspect_ratio": "2:3",
"batchsize": "2",
"step": 6
}'
View the results based on the task ID.
curl --location --request GET 'https://genaiapi.cloudsway.net/v2/ai/lXynAh/images/tasks/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 ''
Invoke using a unified domain name approach.
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"
}'
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 ''