Skip to content

Basic Information

  • Base URL: https://genaiapi.cloudsway.net

  • API request endpoint: POST

  • Authentication: Verified via the HTTP Bearer Token method, and the API key needs to be carried in the request header.

Parameter Name Type Required Description
Content-Type string Yes Fixed as application/json
Authorization string Yes Bearer {your_api_key}

Core Parameter Description

Official Chat Completions API Documentation of OpenAI

Request Parameters


field Meaning Hierarchy Format Required Note
messages The list of messages that make up the current conversation 1 arrary Yes Depending on the model used, different types of message content (modalities) are supported, including text, images and audio.
Developer message Instructions provided by the developer that the model should always follow, regardless of whatever messages the user sends 2 object For models o1 and later versions, developer messages replace the previous system messages.
content Content of Developer Messages 3 string or array Yes
Text content Content of Developer Messages 4 string
Array of content parts An array of content blocks defined by a specific type 4 array For developer messages, only the text type (text) is supported
text Text content 5 string Yes
type Content Block Type 5 string Yes
role Role of the Message Author 3 string Yes Here is the developer
name An optional name for the participant, which is used to provide information to the model to distinguish different participants with the same role. 3 string
System message Instructions provided by the developer, which the model should follow regardless of what message the user sends 2 object For models of version o1 and later, please use developer messages to implement this feature instead
content System Message Content 3 string or array Yes
Text content System Message Content 4 string
Array of content parts An array of content blocks defined by a specific type 4 array For system messages, only the text type (text) is supported
Text content part Text content 5 object
text Text content 6 string Yes
type Content Block Type 6 string Yes
role Role of the Message Author 3 string Yes Here is the system
name An optional name for the participant, which is used to provide information to the model to distinguish different participants with the same role. 3 string
User message The message sent by the end user, which contains a prompt or additional context information 2 object
content Content of the user's message 3 string or array Yes
Text content Content of the user's message 4 string
Array of content parts An array of content blocks defined by a specific type 4 array The supported content types vary depending on the model used to generate the response, and may include text, image or audio inputs.
Text content part Text content 5 object
text Text content 6 string Yes
type Type of content block 6 string Yes
Image content part 5 object
imageurl 6 object Yes
url URL of the image or base64-encoded image data 7 stirng Yes
detail Specify the level of detail for the image 7 stirng Defaults to auto
type Type of content block 6 string Yes
role Role of the message author 3 string Yes Here is the user
name Optional name for the participant, which is used to provide information to the model to distinguish different participants with the same role 3 string
Assistant message A message sent by the model in response to a user message 2 object
role Role of the message author 3 string Yes Here is the assistant
audio Data related to the model's previous audio response 3 object or null
id Unique Device Identifier of the model's previous audio response 4 string Yes
content Content of the assistant's message 3 string or array Required field unless toolcalls or functioncall is specified
Text content Text content of the assistant message 4 string
Array of content parts Array of content blocks with defined types 4 array It may contain one or more text-type content blocks, or exactly one refusal-type content block
Text content part 5 object
text Text content 6 string Yes
type Content Block Type 6 string Yes
Refusal content part 5 object
refusal Rejection message generated by the model 6 string Yes
type Content Block Type 6 string Yes
functioncall Deprecated, replaced by toolcalls 3 object or null Contains the name and parameters of the function to be called generated by the model
name The name of the function to be called 4 string Yes
arguments The parameters used when calling the function are generated by the model in JSON format. 4 string Yes Note: The JSON generated by the model is not necessarily valid and may contain parameters not defined in the function schema. Please validate the parameters before calling the function.
name An optional name for the participant, used to distinguish between different participants with the same role 3 string
refusal Assistant's rejection message 3 string or null
toolcalls Tool calls generated by the model (such as function calls) 3 array
Function tool call Calling the function tool created by the model 4 object
function The function called by the model 5 object Yes
arguments The parameters required when calling a function are generated by the model in JSON format 6 string Yes Please note that the content generated by the model is not always valid JSON, and it may fabricate parameters that are not defined in the function schema. Therefore, validate these parameters in your code before calling the function.
name The name of the function to be called 6 string Yes
id ID of the tool call 5 string Yes
type Currently, only the function type is supported for tools 5 string Yes
Tool message 2 object
content Content of tool messages 3 string or array Yes
Text content Text content of the tool message 4 string
Array of content parts An array of content blocks of a specific type. Only the text type is supported for tool messages. 4 array
Text content part 5 object
text Text content 6 string Yes
type Content Block Type 6 string Yes
role The role of the message author, which is tool here 3 string Yes
toolcallid The ID of the tool call that this message is responding to 3 string Yes
model The model ID used to generate the response, such as gpt-4o or o3 1 string Yes
frequencypenalty A value between -2.0 and 2.0, with a default of 0 1 number or null Positive values penalize based on the existing frequency of the token in the current text, thereby reducing the likelihood that the model will repeat the same content verbatim.
logitbias Adjust the occurrence probability of the specified token in the generated result, which defaults to null 1 map Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to a bias value between -100 and 100. Mathematically, this bias is added to the model's logits right after they are generated and before sampling. The exact effect varies by model, but in general: - Values between -1 and 1 will slightly decrease/increase the selection probability of the corresponding token - Extreme values such as -100 or 100 will completely ban or force the selection of the token
maxcompletiontokens The maximum allowed number of tokens in the generated result (including visible output tokens and inference tokens) 1 integer or null
n The number of chat completion options generated for each input message, which defaults to 1 1 integer or null Note: The fee will be calculated based on the total number of tokens generated for all options, and it is recommended to keep n= 1 to control costs
paralleltoolcalls Specifies whether to enable parallel function invocation when using the tool; the default value is true 1 boolean
presencepenalty A value between -2.0 and 2.0, with a default of 0 1 number or null Positive values penalize based on whether a token has already appeared in the current text, thereby increasing the likelihood that the model will discuss new topics
responseformat An object that specifies the output format of the model 1 object
Text Default Text Response Format 2 object
type The defined response format type. Always text 3 string Yes
JSON schema JSON Schema response format, used to generate structured JSON responses 2 object
jsonschema Configuration options for structured output, including a JSON schema 3 object Yes
name The name of the response format. It must consist of a-z, A-Z, 0-9, or contain underscores and hyphens, with a maximum length of 64 characters. 4 string Yes
description A description of the purpose of this response format, for the model to determine how to respond in this format 4 string
schema The schema of the response format, described in the form of a JSON schema object 4 object
strict Whether to enable strict schema adherence when generating the output. Defaults to false; if set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true 4 boolean or null
type The type of response format, which is fixed as jsonobject 3 string Yes
JSON object JSON Object Response Format 2 object This is a relatively outdated method for generating JSON responses. For models that support jsonschema, it is recommended to use jsonschema. Note that the model will not generate JSON unless there is a system message or a user message instructing it to do so.
type The type of response format defined. It is always a jsonobject. 3 string Yes
seed (Deprecated) If this parameter is specified, the system will try its best to implement deterministic sampling (repeated requests with the same seed and parameters should return the same result). Determinism is not guaranteed, and backend changes need to be monitored via the systemfingerprint response parameter 1 integer or null This feature is currently in the testing phase
stop The latest reasoning models o3 and o4-mini do not support this parameter, and its default value is null. 1 string/array/null Up to 4 stop sequences can be set, and the output will be terminated when the API generates these sequences (the returned text does not include the stop sequences themselves)
store Whether to store the output of this chat completion request for model distillation or product evaluation, the default value is false 1 boolean or null Supports text and image input. Note: Image inputs larger than 10MB will be discarded.
stream If set to true, the model response data will be streamed via Server-Sent Events (SSE); the default value is false. 1 boolean or null
streamoptions Optional parameters for streaming response (only valid when stream is set to true; defaults to null) 1 object or null
includeobfuscation When stream obfuscation is enabled (true by default), random characters are added to streaming events to standardize payload size (as a defense against side-channel attacks). Setting it to false saves bandwidth (ensure the network link is trusted) 2 boolean
includeusage If enabled, an additional data chunk will be sent before the final data: DONE message: the usage field contains the token statistics for the entire request, and the choices field is always an empty array. Note: if the stream is interrupted, the final data chunk containing the total token consumption may not be received. 2 boolean
temperature Sampling temperature (range: 0-2), default value is 1 1 number or null A higher value (e. g., 0.8) increases the randomness of the output, while a lower value (e. g., 0.2) makes the output more concentrated and deterministic. It is recommended to use this parameter as an alternative to the topp parameter.
toolchoice Controls whether (and how) the model invokes tools 1 string or object none: do not call tools, generate messages directly (default when no tools available) auto: automatically choose to generate messages or call tools (default when tools are available) required: one or more tools must be called specified tool: force a specific tool to be called via {"type": "function", "function": {"name": "myfunction"}}
Tool choice mode Tool Selection Mode 2 string none: generate messages directly without invoking tools (default value when no tools are available) auto: automatically choose to generate messages or invoke tools (default value when tools are available) required: one or more tools must be invoked specified tool: force the invocation of a specific tool via {"type": "function", "function": {"name": "myfunction"}}
Function tool choice Mandatorily specify the particular tool that the model should invoke 2 object Used to force the model to call a specific function
function 3 object Yes
name The name of the function that needs to be called 4 string Yes
type Tool type: currently only function is supported 3 object Yes
tools List of tools callable by the model 1 array Currently, only functions are supported to be used as tools, which are used to provide a list of functions for which the model can generate JSON inputs. A maximum of 128 functions are supported.
Function tool A function tool that can be used to generate responses 2 object
function 3 object Yes
name The name of the called function. Only letters (a-z, A-Z), digits (0-9), underscores and hyphens are allowed, with a maximum length of 64 characters. 4 string Yes
description A description of the function's capabilities, used to help the model determine when and how to invoke it 4 string
parameters The parameters accepted by the function are described in JSON Schema format 4 object
strict Specifies whether to enable strict mode when generating function calls. The default value is false; if set to true, the model will strictly follow the JSON Schema structure defined in parameters. 4 boolean or null Only partial JSON Schema features are supported in strict mode
type Tool type. Currently only function is supported 3 string Yes
topp An alternative to temperature sampling — nucleus sampling: the model only considers tokens whose cumulative probability mass falls within the top-p range. The default value is 1. 1 number or null For example, a value of 0.1 means only the tokens corresponding to the top 10% of probability mass are considered. Recommendation: adjust this parameter or temperature, but do not adjust both at the same time

Return Result

Returns a chat completion object, or a stream of chat completion chunk objects if streaming is enabled in the request.

OpenAI endpoint-style request API

POSThttps://genaiapi.cloudsway.net/v1/ai/{ENDPOINT_PATH}/chat/completions

Sample Request and Response Results

curl request

curl https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT_PATH}/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${your_AK}" \
  -d '{
    "model": "gpt-5",
    "messages": [
      {
        "role": "developer",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'

Response Result

{
  "id": "chatcmpl-B9MBs8CjcvOU2jLn4n570S5qMJKcT",
  "object": "chat.completion",
  "created": 1741569952,
  "model": "gpt-4.1-2025-04-14",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 19,
    "completion_tokens": 10,
    "total_tokens": 29,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "service_tier": "default"
}

OpenAI integrates Chat Completion request API

POST https://genaiapi.cloudsway.net/v1/chat/completions

Sample Request and Response Results

curl request

curl https://genaiapi.cloudsway.net/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${your_AK}" \
  -d '{
    "model": "{MaaS Moddel Name}",
    "messages": [
      {
        "role": "developer",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'

Response Result

curl https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT_PATH}/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${your_AK}" \
  -d '{
    "model": "gpt-5",
    "messages": [
      {
        "role": "developer",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'

Official Response API Documentation of OpenAI

Synchronization Mode

streaming request

curl 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/responses' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json' \
    --data '{
        "input": "1+2+n=?",
        "model": "gpt-o3-pro-2025-06-10",
            "stream": true,
            "reasoning": {
                "effort": "high",
                "summary": "auto"
            }
        }'

Tool call invocation

First Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/responses' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer ${your_AK}' \
    --data '{
        "model": "MaaS-o3-mini-2025-01-31",
        "input": "What is the weather like in Boston today?",
        "tools": [
          {
            "type": "function",
            "name": "get_current_weather",
            "description": "Get the current weather in a given location",
            "parameters": {
              "type": "object",
              "properties": {
                "location": {
                  "type": "string",
                  "description": "The city and state, e.g. San Francisco, CA"
                },
                "unit": {
                  "type": "string",
                  "enum": ["celsius", "fahrenheit"]
                }
              },
              "required": ["location", "unit"]
            }
          }
        ],
        "tool_choice": "auto"
      }'

Response

{
        "id": "resp_68906124c3f08190995b6b59b54bc1300718351d629a7990",
        "object": "response",
        "created_at": 1754292516,
        "status": "completed",
        "background": false,
        "content_filters": null,
        "error": null,
        "incomplete_details": null,
        "instructions": null,
        "max_output_tokens": null,
        "max_tool_calls": null,
        "model": "MaaS-o3-mini-2025-01-31",
        "output": [
            {
                "id": "rs_6890612fc9448190be00d13682364ca30718351d629a7990",
                "type": "reasoning",
                "summary": []
            },
            {
                "id": "fc_6890612fcb44819086adeb804dbd6dbf0718351d629a7990",
                "type": "function_call",
                "status": "completed",
                "arguments": "{\"location\":\"Boston, MA\",\"unit\":\"fahrenheit\"}",
                "call_id": "call_8KWaObBBaHuJsbGcgEQ6OWFK",
                "name": "get_current_weather"
            }
        ],
        "parallel_tool_calls": true,
        "previous_response_id": null,
        "prompt_cache_key": null,
        "reasoning": {
            "effort": "medium",
            "summary": null
        },
        "safety_identifier": null,
        "service_tier": "default",
        "store": true,
        "temperature": 1.0,
        "text": {
            "format": {
                "type": "text"
            }
        },
        "tool_choice": "auto",
        "tools": [
            {
                "type": "function",
                "description": "Get the current weather in a given location",
                "name": "get_current_weather",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "The city and state, e.g. San Francisco, CA"
                        },
                        "unit": {
                            "type": "string",
                            "enum": [
                                "celsius",
                                "fahrenheit"
                            ]
                        }
                    },
                    "required": [
                        "location",
                        "unit"
                    ]
                },
                "strict": true
            }
        ],
        "top_p": 1.0,
        "truncation": "disabled",
        "usage": {
            "input_tokens": 77,
            "input_tokens_details": {
                "cached_tokens": 0
            },
            "output_tokens": 28,
            "output_tokens_details": {
                "reasoning_tokens": 0
            },
            "total_tokens": 105
        },
        "user": null,
        "metadata": {}
    }

Second Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/responses' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer ${your_AK}' \
    --data '{
        "model": "MaaS-o3-mini-2025-01-31",
        "input": [

            {
                "role": "user",
                "content": "What is the weather like in Boston today?"
            },


            {
                "id": "rs_6890612fc9448190be00d13682364ca30718351d629a7990",
                "type": "reasoning",
                "summary": []
            },


            {
                "id": "fc_6890612fcb44819086adeb804dbd6dbf0718351d629a7990",
                "type": "function_call",
                "call_id": "call_8KWaObBBaHuJsbGcgEQ6OWFK",

                "name": "get_current_weather",
                "arguments": "{\"location\":\"Boston, MA\",\"unit\":\"fahrenheit\"}"
            },


            {
                "type": "function_call_output",
                "call_id": "call_8KWaObBBaHuJsbGcgEQ6OWFK",
                "output": "68"  
            }
        ],
        "tools": [

            {
                "type": "function",
                "name": "get_current_weather",  
                "description": "Get the current weather in a given location",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "The city and state, e.g. San Francisco, CA"
                        },
                        "unit": {
                            "type": "string",
                            "enum": ["celsius", "fahrenheit"]
                        }
                    },
                    "required": ["location", "unit"]
                }
            }
        ]
    }'

Response

{
        "id": "resp_6890637dcef081909a45e5996c1004d20718351d629a7990",
        "object": "response",
        "created_at": 1754293117,
        "status": "completed",
        "background": false,
        "content_filters": null,
        "error": null,
        "incomplete_details": null,
        "instructions": null,
        "max_output_tokens": null,
        "max_tool_calls": null,
        "model": "MaaS-o3-mini-2025-01-31",
        "output": [
            {
                "id": "msg_6890638be07481909fe137356876ea180718351d629a7990",
                "type": "message",
                "status": "completed",
                "content": [
                    {
                        "type": "output_text",
                        "annotations": [],
                        "text": "The current temperature in Boston is 68 °F."
                    }
                ],
                "role": "assistant"
            }
        ],
        "parallel_tool_calls": true,
        "previous_response_id": null,
        "prompt_cache_key": null,
        "reasoning": {
            "effort": "medium",
            "summary": null
        },
        "safety_identifier": null,
        "service_tier": "default",
        "store": true,
        "temperature": 1.0,
        "text": {
            "format": {
                "type": "text"
            }
        },
        "tool_choice": "auto",
        "tools": [
            {
                "type": "function",
                "description": "Get the current weather in a given location",
                "name": "get_current_weather",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "The city and state, e.g. San Francisco, CA"
                        },
                        "unit": {
                            "type": "string",
                            "enum": [
                                "celsius",
                                "fahrenheit"
                            ]
                        }
                    },
                    "required": [
                        "location",
                        "unit"
                    ]
                },
                "strict": true
            }
        ],
        "top_p": 1.0,
        "truncation": "disabled",
        "usage": {
            "input_tokens": 180,
            "input_tokens_details": {
                "cached_tokens": 0
            },
            "output_tokens": 15,
            "output_tokens_details": {
                "reasoning_tokens": 0
            },
            "total_tokens": 195
        },
        "user": null,
        "metadata": {}
    }

Thinking Mode Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json' \
    --data '{
      "input": "1+2+n=?",
      "model": "MaaS-o3-mini-2025-01-31",
      "reasoning": {
        "effort": "high",
        "summary": "detailed"
      }
    }'

Thinking Pattern Response

{
        "id": "resp_68904df39c0c8190a11c8a48c8f84957006db06e07770eb8",
        "model": "MaaS-o3-mini-2025-01-31",
        "background": false,
        "instructions": null,
        "object": "response",
        "output": [
            {
                "summary": [
                    {
                        "type": "summary_text",
                        "text": "**Simplifying an expression**\n\nI see the user is asking for the result of 1 + 2 + n. Without context, I can just give them the symbolic expression: 3 + n. If n is an integer, it might help to ask for clarification about n, but since it's unknown, the result remains 3 + n. The user may initially want to see that mathematical expression, so I’ll present it as 3 + n with that explanation. This all seems straightforward."
                    }
                ],
                "type": "reasoning",
                "id": "rs_68904e02c9488190b84ddd71c371c68d006db06e07770eb8"
            },
            {
                "role": "assistant",
                "type": "message",
                "content": [
                    {
                        "annotations": [],
                        "type": "output_text",
                        "text": "Without knowing the value of n, the sum remains symbolic:\n\n1 + 2 + n = 3 + n"
                    }
                ],
                "id": "msg_68904e05d5b481909afe35fbcb122312006db06e07770eb8",
                "status": "completed"
            }
        ],
        "temperature": 1.0,
        "text": {
            "format": {
                "type": "text"
            }
        },
        "created_at": 1754287603,
        "error": null,
        "incomplete_details": null,
        "max_output_tokens": null,
        "metadata": {},
        "output_text": null,
        "parallel_tool_calls": true,
        "previous_response_id": null,
        "reasoning": {
            "effort": "high",
            "summary": "detailed"
        },
        "status": "completed",
        "tool_choice": "auto",
        "tools": [],
        "top_p": 1.0,
        "truncation": "disabled",
        "user": null,
        "usage": {
            "input_tokens": 12,
            "input_tokens_details": {
                "cached_tokens": 0
            },
            "output_tokens": 93,
            "output_tokens_details": {
                "reasoning_tokens": 64
            },
            "total_tokens": 105
        }
    }

image recognition

URL-formatted request

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json' \
    --data '{
        "model": "MaaS-o3-mini-2025-01-31",


         "input": [
          {
            "role": "user",
            "content": [
              {"type": "input_text", "text": "Describe the content in this image"},
              {
                "type": "input_image",
                "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
              }
            ]
          }
        ]
    }'

base64 formatted request

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json' \
    --data '{
        "model": "MaaS-o3-mini-2025-01-31",


         "input": [
          {
            "role": "user",
            "content": [
              {"type": "input_text", "text": "Describe the content in this image"},
              {
                "type": "input_image",
                "image_url": "data:image/png;base64,iVBORwxxxx"
              }
            ]
          }
        ]
    }'

Multi-turn Dialogue Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json' \
    --data '{
        "input": "What is 1+1?",
        "model": "MaaS-o3-mini-2025-01-31",    
        "reasoning": {
            "effort": "high",
            "summary": "detailed"
        }
    }'

Response

{
        "id": "resp_6892f0b52de48190951e6b39e336957b03dd80b38745bdda",
        "model": "MaaS-o3-mini-2025-01-31",
        "background": false,
        "instructions": null,
        "object": "response",
        "output": [
            {
                "summary": [],
                "type": "reasoning",
                "id": "rs_6892f0c957308190bbda9ea58c26186f03dd80b38745bdda"
            },
            {
                "role": "assistant",
                "type": "message",
                "content": [
                    {
                        "annotations": [],
                        "type": "output_text",
                        "text": "1+1 equals 2."
                    }
                ],
                "id": "msg_6892f0c9588c81908fdbb97e05cd07b503dd80b38745bdda",
                "status": "completed"
            }
        ],
        "temperature": 1.0,
        "text": {
            "format": {
                "type": "text"
            }
        },
        "created_at": 1754460341,
        "error": null,
        "incomplete_details": null,
        "max_output_tokens": null,
        "max_tool_calls": null,
        "metadata": {},
        "output_text": null,
        "parallel_tool_calls": true,
        "previous_response_id": null,
        "prompt": null,
        "prompt_cache_key": null,
        "reasoning": {
            "effort": "high",
            "summary": "detailed"
        },
        "safety_identifier": null,
        "service_tier": "default",
        "status": "completed",
        "tool_choice": "auto",
        "tools": [],
        "top_logprobs": null,
        "top_p": 1.0,
        "truncation": "disabled",
        "user": null,
        "usage": {
            "input_tokens": 12,
            "input_tokens_details": {
                "cached_tokens": 0
            },
            "output_tokens": 13,
            "output_tokens_details": {
                "reasoning_tokens": 0
            },
            "total_tokens": 25
        }
    }

Second Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json' \
    --data '{
        "input": "What is the result if you add 1 more?",
        "model": "MaaS-o3-mini-2025-01-31",
        "previous_response_id":"resp_6892f0b52de48190951e6b39e336957b03dd80b38745bdda",

        "reasoning": {
            "effort": "high",
            "summary": "detailed"
        }
    }'

Asynchronous Mode

Request

Add "background": true to all synchronous requests, and carry the id in asynchronous GET requests

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json' \
    --data '{
        "input": "1+2+n=?",
            "background": true,
        "model": "MaaS-o3-mini-2025-01-31",
        "stream": true,
        "reasoning": {
            "effort": "high",
            "summary": "detailed"
        }
    }'

Response

{
        "id": "resp_6894071015f48190ba7629ad68d68f850427f468a587cfc8",
        "model": "MaaS-o3-mini-2025-01-31",
        "background": true,
        "instructions": null,
        "object": "response",
        "output": [],
        "temperature": 1.0,
        "text": {
            "format": {
                "type": "text"
            }
        },
        "created_at": 1754531600,
        "error": null,
        "incomplete_details": null,
        "max_output_tokens": null,
        "max_tool_calls": null,
        "metadata": {},
        "output_text": null,
        "parallel_tool_calls": true,
        "previous_response_id": null,
        "prompt": null,
        "prompt_cache_key": null,
        "reasoning": {
            "effort": "medium"
        },
        "safety_identifier": null,
        "service_tier": "auto",
        "status": "queued",
        "tool_choice": "auto",
        "tools": null,
        "top_logprobs": null,
        "top_p": 1.0,
        "truncation": "disabled",
        "user": null,
        "usage": null
    }

GET Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses/resp_689329c4e7e0819096e0c35b597fabe00aecb4e10eaeff14?stream=false&api-version=preview' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json'

Custom Tools

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json' \
    --data '{
        "model": "MaaS-o3-mini-2025-01-31",
        "input": "What is the weather like in Boston today?",
        "background": true,
        "tools": [
            {
                "type": "function",
                "name": "get_current_weather",
                "description": "Get the current weather in a given location",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "The city and state, e.g. San Francisco, CA"
                        },
                        "unit": {
                            "type": "string",
                            "enum": [
                                "celsius",
                                "fahrenheit"
                            ]
                        }
                    },
                    "required": [
                        "location",
                        "unit"
                    ]
                }
            }
        ],
        "tool_choice": {
            "type": "allowed_tools",
            "mode": "auto",
            "tools": [
                {
                    "type": "function",
                    "name": "get_current_weather"
                }
            ]
        }
    }'

GET Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses/resp_6899863171fc819eae78cfa894930df804e06299c206248b?stream=false' \
    --header 'Authorization: Bearer ${your_AK}' \
    --header 'Content-Type: application/json'