Skip to content

Response

Synchronous Mode

Streaming Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/responses' \
--header 'Authorization: Bearer {YOUR_ACCESS_KEY}' \
--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

First Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/responses' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_ACCESS_KEY}' \
--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_ACCESS_KEY}' \
--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_ACCESS_KEY}' \
--header 'Content-Type: application/json' \
--data '{
  "input": "1+2+n=?",
  "model": "MaaS-o3-mini-2025-01-31",
  "reasoning": {
    "effort": "high",
    "summary": "detailed"
  }
}'

Thinking Mode 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_ACCESS_KEY}' \
--header 'Content-Type: application/json' \
--data '{
    "model": "MaaS-o3-mini-2025-01-31",


     "input": [
      {
        "role": "user",
        "content": [
          {"type": "input_text", "text": "给我描述图里内容"},
          {
            "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_ACCESS_KEY}' \
--header 'Content-Type: application/json' \
--data '{
    "model": "MaaS-o3-mini-2025-01-31",


     "input": [
      {
        "role": "user",
        "content": [
          {"type": "input_text", "text": "给我描述图里内容"},
          {
            "type": "input_image",
            "image_url": "data:image/png;base64,iVBORwxxxx"
          }
        ]
      }
    ]
}'

Multi-turn Conversation Request

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
--header 'Authorization: Bearer {YOUR_ACCESS_KEY}' \
--header 'Content-Type: application/json' \
--data '{
    "input": "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等于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_ACCESS_KEY}' \
--header 'Content-Type: application/json' \
--data '{
    "input": "继续加1等于多少",
    "model": "MaaS-o3-mini-2025-01-31",
    "previous_response_id":"resp_6892f0b52de48190951e6b39e336957b03dd80b38745bdda",

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

Asynchronous Mode

Request

For all synchronous requests, add the parameter background: true. For asynchronous GET requests, carry the id (parameter) when sending the request.

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
--header 'Authorization: Bearer {YOUR_ACCESS_KEY}' \
--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_ACCESS_KEY}' \
--header 'Content-Type: application/json'

Custom Tool

curl 'https://genaiapi.cloudsway.net/v1/ai/{ENDPOINT}/responses' \
--header 'Authorization: Bearer {YOUR_ACCESS_KEY}' \
--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_ACCESS_KEY}' \
--header 'Content-Type: application/json'