Skip to content

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

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"
}'