Skip to content

Quickstart

This guide will help you get started with MaaS API. We will walk you through the process of creating a simple AI model that can predict the price of a house based on its size.

Step 1: Log in to the console to obtain your access key.

After logging into Cloudsway Console with your account, follow the illustrated steps to navigate and find your access key information. The AK is the credential for accessing the MaaS API, so please keep it safe.

The login page is here

alt text

Get your access key from the user profiles menu. alt text

Then you can see your access key. alt text

Step 2:Access the MaaS API to complete the resource purchase.

Navigate to the MaaS API, in the model list, click 'Create' and select a model based on your needs. You can tag the model resources and categorize them into specified resource groups for easier future management.

alt text

Once created, you will see the corresponding endpoint generated in the list page. You can also enable or disable the endpoint as needed.

alt text

Step 3: Complete the call

Unified Domain Name Call

1.First, obtain the list of purchased models.

curl --location 'https://genaiapi.cloudsway.net/v1/models' \
--header 'Authorization: Bearer YOUR_ACCESS_KEY'

The above interface will return all models owned by the AK account.

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

2.Call the model specified in the above model list.

The model parameter must be consistent with the values returned in the model list. Take this model as an example.

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

Specify an endpoint call model

Obtain the AK information and endpoint information from the console to complete the call.

curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/sVUARttwSjilLOZY/chat/completions' -H 'Authorization: Bearer YOU_API_KEY' -H 'Content-Type: application/json' --data '{
    "model": "gpt-4",
    "messages": [
        {
            "role": "user",
            "content": "hello"
        }
    ]
}'

You can see the result of the completion

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null,
      "messages": [
        {
          "role": "assistant",
          "content": "I'm doing well, thank you for asking. How can I help you today?"
        }
      ]
    }
  ],
  "created": 1632345678,
  "model": "gpt-4-turbo",
  "object": null,
  "system_fingerprint": null,
  "usage": {
    "completion_tokens": 100,
    "prompt_tokens": 20,
    "total_tokens": 120
  }
}

Step 4:Configure Content Filters

Log in to the MaaS API Console, and according to the business scenario, upload sensitive words in CSV/xlsx format and bind them to the client endpoint to take effect. The platform will filter inputs and outputs based on the uploaded sensitive words.

alt text

alt text

Step 5:View audit logs in the console

Log in to the MaaS API Console,View audit logs.

alt text

Step 6:View monitoring data in the console

Log in to the MaaS API Console,check usage, latency, and other data.

alt text

Step 7:Manage Resource Group

You can categorize resources by assigning them to designated resource groups. This facilitates the management of billing for those resources.

1.Visit Resource Group to view resource group information. You can create, delete resource groups, and transfer resources in and out.

alt text

2.Transfer other resources into the resource group

alt text

3.Transfer resources out to other resource groups

alt text

4.View billing details for the resource group.

Visit Billing,click to download and extract the usage costs of certain resource groups from the billing table.

alt text