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。
Get your access key from the user profiles menu.
Then you can see your access key.
Step 2:Access the MaaS API to complete the resource purchase.
Navigate to the MaaS API, click on "Create" in the model list, and select the model type and specific model according to your requirements.
Once created, you will see the corresponding endpoint generated in the list page. You can also enable or disable the endpoint as needed.
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.
Step 5:View audit logs in the console
Log in to the MaaS API Console,View audit logs.
Step 6:View monitoring data in the console
Log in to the MaaS API Console,check usage, latency, and other data.