跳转至

MaaS_GP_5.4系列

基本信息

项目 说明
基础URL https://genaiapi.cloudsway.net/v1/
认证方式 Bearer Token (API Key)
响应格式 JSON
请求格式 JSON

新功能介绍

与之前的 MaaS_GP_5 模型一样,MaaS_GP_5.4 支持自定义工具、用于控制详细程度和推理能力的参数以及允许的工具列表。MaaS_GP_5.4 还引入了多项功能,使构建强大的代理系统、处理更庞大的信息量以及运行更可靠的自动化工作流程变得更加容易:

  • tool_search 在 API 中: MaaS_GP_5.4 通过延迟加载工具,改进了大型工具生态系统的工具搜索功能。这使得工具可搜索,仅加载相关定义,减少了令牌使用量,并提高了实际部署中工具选择的准确性。

  • 100万词汇上下文窗口: MaaS_GP_5.4 支持高达100万词汇的上下文窗口,从而可以更轻松地在单次请求中分析整个代码库、长文档集合或扩展的代理轨迹。请阅读“100万词汇上下文窗口”部分了解更多信息。

  • 内置计算机使用功能: MaaS_GP_5.4 是首个内置计算机使用功能的主流模型,使智能体能够直接与软件交互,以在构建-运行-验证-修复循环中完成、验证和修复任务。

  • 原生压缩支持: MaaS_GP_5.4 是第一个经过训练支持压缩的主流模型,能够在保留关键上下文的同时实现更长的智能体轨迹。

模型能力列表

能力 / 模型 MaaS_GP_5.4 MaaS_GP_5.4_pro MaaS_GP_5.4_mini MaaS_GP_5.4_nano
输入支持 文本、图像 文本、图像 文本、图像 文本、图像
/Chat Completions
/Responses
Tool search
Web search
Computer Use支持
最适合 通用型工作,包括复杂的推理、广泛的世界知识以及代码量大或多步骤的智能体任务。 棘手的问题,可能需要更长时间才能解决,并且需要更深入的推理。 大量编码、计算机使用以及仍然需要强大推理能力的代理工作流程。 速度和成本最为重要的简单高吞吐量任务。

请求参数

参数 类型 必填 说明
model string 模型名称
messages array 对话消息列表
temperature float 采样温度 (0-2),默认1.0
top_p float 核采样参数 (0-1),默认1.0
max_tokens int 最大生成token数
stream boolean 是否流式输出,默认false
presence_penalty float -2.0 到 2.0
frequency_penalty float -2.0 到 2.0
seed int 确定性生成种子

以下参数仅在使用 MaaS_GP_5.4 且推理难度设置为none时受支持:

  • temperature

  • top_p

  • logprobs

phase参数

对于响应 API 中长时间运行或工具较多的 MaaS_GP_5.4流程,请使用助手消息phase字段以避免提前停止和其他不良行为。

phase在 API 层面上是可选的,但我们强烈建议使用它。用于phase: "commentary"中间助手更新(例如工具调用前的提示信息)和phase: "final_answer"最终答案。请勿将其添加phase到用户消息中。

请求示例

/responses

/responses:非流式同步请求

Curl 请求

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "MaaS_GP_5.4_mini",
    "input": "问题A:回答A."
  }'

Python 请求

import requests

url = "https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses"

payload = {
    "model": "MaaS_GP_5.4_mini",
    "input": "问题A:回答A."
}

headers = {
    "Authorization": "Bearer {YOUR_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(url, json=payload, headers=headers)
    response.raise_for_status()  # 如果状态码不是 200,会抛出异常
    print(response.status_code)
    print(response.json())
except requests.exceptions.RequestException as e:
    print(f"请求出错: {e}")

返回示例

{
    "top_logprobs": 0,
    "metadata": {},
    "presence_penalty": 0.0,
    "reasoning": {
        "effort": "none"
    },
    "usage": {
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "input_tokens": 12,
        "output_tokens_details": {
            "reasoning_tokens": 0
        },
        "total_tokens": 36,
        "output_tokens": 24
    },
    "created_at": 1775556238,
    "store": true,
    "tools": [],
    "content_filters": [
        {
            "content_filter_results": {
                "self_harm": {
                    "severity": "safe",
                    "filtered": false
                },
                "jailbreak": {
                    "filtered": false,
                    "detected": false
                },
                "hate": {
                    "severity": "safe",
                    "filtered": false
                },
                "sexual": {
                    "severity": "safe",
                    "filtered": false
                },
                "violence": {
                    "severity": "safe",
                    "filtered": false
                }
            },
            "content_filter_offsets": {
                "end_offset": 840,
                "start_offset": 0,
                "check_offset": 0
            },
            "source_type": "prompt",
            "content_filter_raw": [],
            "blocked": false
        }
    ],
    "output": [
        {
            "phase": "final_answer",
            "role": "assistant",
            "type": "message",
            "content": [
                {
                    "annotations": [],
                    "type": "output_text",
                    "logprobs": [],
                    "text": "当然可以。请把“问题A”的具体内容发给我,我会直接回答“A”。"
                }
            ],
            "id": "msg_0e27378e1f3e955e0069d4d68f1b448193870af25f1aacd3e2",
            "status": "completed"
        }
    ],
    "top_p": 0.98,
    "completed_at": 1775556239,
    "frequency_penalty": 0.0,
    "parallel_tool_calls": true,
    "background": false,
    "temperature": 1.0,
    "tool_choice": "auto",
    "model": "MaaS_GP_5.4_mini_20260317",
    "service_tier": "auto",
    "id": "resp_0e27378e1f3e955e0069d4d68ed438819387245017afa12e6c",
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "truncation": "disabled",
    "object": "response",
    "status": "completed"
}

/responses:流式同步请求

Curl 请求示例


curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "MaaS_GP_5.4_mini",
    "input": "问题A:回答A.",
    "stream": true
  }'

Python 请求示例

import requests
import json

url = "https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {YOUR_API_KEY}"
}

payload = {
    "input": [
        {
            "role": "developer",
            "content": "Talk like a pirate."
        },
        {
            "role": "user",
            "content": "Are semicolons optional in JavaScript?"
        }
    ],
    "stream": True
}

# 使用 stream=True 参数启用流式响应
with requests.post(url, headers=headers, json=payload, stream=True) as response:
    response.raise_for_status()

    # 逐行读取流式响应
    for line in response.iter_lines(decode_unicode=True):
        if line:
            # 处理 SSE (Server-Sent Events) 格式的数据
            if line.startswith('data: '):
                data_str = line[6:]  # 移除 'data: ' 前缀
                if data_str != '[DONE]':
                    try:
                        data = json.loads(data_str)
                        print(data)
                    except json.JSONDecodeError:
                        print(data_str)

/responses:非流式异步请求

Curl 请求示例

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "background": true,
    "model": "MaaS_GP_5.4_mini",
    "input": "问题A:回答A."
  }'

Python 请求示例

import requests

url = "https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {YOUR_API_KEY}"
}
payload = {
    "background": True,
    "input": [
        {"role": "developer", "content": "Talk like a pirate."},
        {"role": "user", "content": "Are semicolons optional in JavaScript?"}
    ]
}

response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())

返回示例

{
    "top_logprobs": 0,
    "metadata": {},
    "presence_penalty": 0.0,
    "reasoning": {
        "effort": "medium"
    },
    "created_at": 1775617385,
    "store": true,
    "tools": [],
    "output": [],
    "top_p": 1.0,
    "frequency_penalty": 0.0,
    "parallel_tool_calls": true,
    "background": true,
    "temperature": 1.0,
    "tool_choice": "auto",
    "model": "MaaS_GP_5_mini_20250807",
    "service_tier": "auto",
    "id": "resp_04040303cf238c130069d5c569cbcc81959f0a59b62453cba4",
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "truncation": "disabled",
    "object": "response",
    "status": "queued"
}

/responses:流式异步请求

curl "https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -d '{
        "background": true,
        "stream": true,
        "input": [
            {
                "role": "developer",
                "content": "Talk like a pirate."
            },
            {
                "role": "user",
                "content": "Are semicolons optional in JavaScript?"
            }
        ]
    }'

Python 请求示例

import requests

url = "https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {YOUR_API_KEY}"
}
payload = {
    "background": True,
    "stream": True,
    "input": [
        {"role": "developer", "content": "Talk like a pirate."},
        {"role": "user", "content": "Are semicolons optional in JavaScript?"}
    ]
}

# 流式异步请求
with requests.post(url, headers=headers, json=payload, stream=True) as response:
    for line in response.iter_lines(decode_unicode=True):
        if line:
            print(line)

/responses:获取异步请求结果

curl --location --request GET 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses/resp_0bd529239ed0ff590069bb8f70a8448193976feb98de696212' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{}'

返回示例

{
    "top_logprobs": 0,
    "metadata": {},
    "presence_penalty": 0.0,
    "reasoning": {
        "effort": "none"
    },
    "usage": {
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "input_tokens": 24,
        "output_tokens_details": {
            "reasoning_tokens": 0
        },
        "total_tokens": 233,
        "output_tokens": 209
    },
    "created_at": 1775627820,
    "store": true,
    "tools": [],
    "content_filters": [
        {
            "content_filter_results": {
                "self_harm": {
                    "severity": "safe",
                    "filtered": false
                },
                "jailbreak": {
                    "filtered": false,
                    "detected": false
                },
                "hate": {
                    "severity": "safe",
                    "filtered": false
                },
                "sexual": {
                    "severity": "safe",
                    "filtered": false
                },
                "violence": {
                    "severity": "safe",
                    "filtered": false
                }
            },
            "content_filter_offsets": {
                "end_offset": 870,
                "start_offset": 0,
                "check_offset": 0
            },
            "source_type": "prompt",
            "content_filter_raw": [],
            "blocked": false
        }
    ],
    "output": [
        {
            "phase": "final_answer",
            "role": "assistant",
            "type": "message",
            "content": [
                {
                    "annotations": [],
                    "type": "output_text",
                    "logprobs": [],
                    "text": "Arrr, aye — semicolons be **optional** in JavaScript much of the time, because the language has **automatic semicolon insertion**.\n\nBut beware:\n\n- JavaScript will **sometimes add them for ye**\n- and sometimes **not the way ye expect**\n- so omitting them can lead to weird bugs\n\n### Example\n```js\nconst a = 1\nconst b = 2\nconsole.log(a + b)\n```\nThis usually works fine.\n\n### But this can break\n```js\nreturn\n{\n  ok: true\n}\n```\nJavaScript treats that like:\n```js\nreturn;\n{\n  ok: true\n}\n```\nSo it returns `undefined`.\n\n### Rule of thumb\n- **Yes, semicolons are optional**\n- **No, it’s not always safe to skip them**\n- Many crews use semicolons anyway to avoid trouble\n\nIf ye want, I can show ye the main JavaScript gotchas with semicolon insertion, matey."
                }
            ],
            "id": "msg_03796fc2ac85b8190069d5ee30dbf88195898413def497ddd0",
            "status": "completed"
        }
    ],
    "top_p": 0.98,
    "completed_at": 1775627826,
    "frequency_penalty": 0.0,
    "parallel_tool_calls": true,
    "background": true,
    "temperature": 1.0,
    "tool_choice": "auto",
    "model": "MaaS_GP_5.4_mini_20260317",
    "service_tier": "auto",
    "id": "resp_03796fc2ac85b8190069d5ee2c38b4819582ae06f00a1817d8",
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "truncation": "disabled",
    "object": "response",
    "status": "completed"
}

/chat/completions

/chat/completions 非流式请求

curl "https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -d '{
        "messages": [
            {
                "role": "developer",
                "content": "Talk like a pirate."
            },
            {
                "role": "user",
                "content": "Are semicolons optional in JavaScript?"
            }
        ]
    }'

Python 请求示例

import requests

# 接口地址(替换你的实际 endpointPath)
url = "https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions"

# 请求头
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {YOUR_API_KEY}"
}

data = {
    "messages": [
        {
            "role": "developer",
            "content": "Talk like a pirate."
        },
        {
            "role": "user",
            "content": "Are semicolons optional in JavaScript?"
        }
    ]
}

# 发送 POST 请求
response = requests.post(url, headers=headers, json=data)

# 打印结果
print("状态码:", response.status_code)
print("返回结果:", response.json())

响应示例

{
    "id": "chatcmpl-DRvzyVchkK7ZR0WqwMsHUomRujwSL",
    "choices": [
        {
            "index": 0,
            "logprobs": null,
            "message": {
                "role": "assistant",
                "content": "Aye, mostly — but not always.\n\nJavaScript has a feature called **Automatic Semicolon Insertion (ASI)**, which means the engine can often add semicolons for ye when they’re omitted.\n\nExample:\n\n```js\nlet x = 5\nlet y = 10\nconsole.log(x + y)\n```\n\nThat usually works fine.\n\nBut there be **dangerous cases** where leaving them out can change the meaning or break the code. For example:\n\n```js\nlet a = 1\nlet b = 2\n[a, b].forEach(console.log)\n```\n\nJavaScript might treat that `[` as continuing the previous line, which can cause trouble.\n\nAnother classic trap:\n\n```js\nreturn\n{\n  name: \"Jack\"\n}\n```\n\nThis becomes:\n\n```js\nreturn;\n{\n  name: \"Jack\"\n}\n```\n\nSo it returns `undefined`, not the object.\n\n## Short answer\n- **Yes**, semicolons are often optional.\n- **No**, they are not always safe to omit.\n\n## Best practice\nMany crews choose one of these:\n- **Always use semicolons** for safety and clarity, or\n- **Omit them consistently** only if ye understand ASI rules well and use a formatter/linter like **Prettier** or **ESLint**.\n\nSo: **optional by syntax in many cases, but not truly optional in practice unless ye be careful.**",
                "refusal": null,
                "annotations": [],
                "images": null,
                "reasoning_content": null,
                "function_call": null,
                "tool_calls": null,
                "reasoning_details": null
            },
            "finish_reason": "stop",
            "native_finish_reason": null
        }
    ],
    "logprobs": null,
    "created": 1775550174,
    "model": "MaaS_GP_5.4_20260305",
    "object": "chat.completion",
    "system_fingerprint": null,
    "service_tier": null,
    "usage": {
        "prompt_tokens": 24,
        "completion_tokens": 299,
        "total_tokens": 323,
        "completion_tokens_details": {
            "accepted_prediction_tokens": 0,
            "audio_tokens": 0,
            "image_tokens": 0,
            "reasoning_tokens": 0,
            "rejected_prediction_tokens": 0
        },
        "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 0
        },
        "cache_creation_input_tokens": null,
        "cache_creation": null,
        "gemini_cache_tokens_details": null
    }
}

/chat/completions 流式请求

curl "https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -d '{
        "messages": [
            {
                "role": "developer",
                "content": "Talk like a pirate."
            },
            {
                "role": "user",
                "content": "Are semicolons optional in JavaScript?"
            }
        ],
        "stream": true
    }'

tool_search不支持/chat/completions,只支持/responses

请求示例

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "input": "List open orders for customer CUST-12345.",
    "parallel_tool_calls": false,
    "tools": [
      {
        "type": "namespace",
        "name": "crm",
        "description": "CRM tools for customer lookup and order management.",
        "tools": [
          {
            "type": "function",
            "name": "get_customer_profile",
            "description": "Fetch a customer profile by customer ID.",
            "parameters": {
              "type": "object",
              "properties": {
                "customer_id": { "type": "string" }
              },
              "required": ["customer_id"],
              "additionalProperties": false
            }
          },
          {
            "type": "function",
            "name": "list_open_orders",
            "description": "List open orders for a customer ID.",
            "defer_loading": true,
            "parameters": {
              "type": "object",
              "properties": {
                "customer_id": { "type": "string" }
              },
              "required": ["customer_id"],
              "additionalProperties": false
            }
          }
        ]
      },
      { "type": "tool_search" }
    ]
  }'

预期会在 output 里看到类似:

  • tool_search_call

  • tool_search_output

  • 后续 function_call(如 list_open_orders)

返回示例

{
    "top_logprobs": 0,
    "metadata": {},
    "presence_penalty": 0.0,
    "reasoning": {
        "effort": "none"
    },
    "usage": {
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "input_tokens": 593,
        "output_tokens_details": {
            "reasoning_tokens": 19
        },
        "total_tokens": 636,
        "output_tokens": 43
    },
    "created_at": 1775627905,
    "store": true,
    "tools": [
        {
            "type": "tool_search"
        },
        {
            "description": "CRM tools for customer lookup and order management.",
            "type": "namespace",
            "tools": [
                {
                    "description": "Fetch a customer profile by customer ID.",
                    "type": "function",
                    "name": "get_customer_profile",
                    "strict": true,
                    "parameters": {
                        "type": "object",
                        "required": [
                            "customer_id"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "customer_id": {
                                "type": "string"
                            }
                        }
                    }
                },
                {
                    "description": "List open orders for a customer ID.",
                    "type": "function",
                    "defer_loading": true,
                    "name": "list_open_orders",
                    "strict": true,
                    "parameters": {
                        "type": "object",
                        "required": [
                            "customer_id"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "customer_id": {
                                "type": "string"
                            }
                        }
                    }
                }
            ],
            "name": "crm"
        }
    ],
    "content_filters": [
        {
            "content_filter_results": {
                "self_harm": {
                    "severity": "safe",
                    "filtered": false
                },
                "jailbreak": {
                    "filtered": false,
                    "detected": false
                },
                "hate": {
                    "severity": "safe",
                    "filtered": false
                },
                "sexual": {
                    "severity": "safe",
                    "filtered": false
                },
                "violence": {
                    "severity": "safe",
                    "filtered": false
                }
            },
            "content_filter_offsets": {
                "end_offset": 2559,
                "start_offset": 0,
                "check_offset": 0
            },
            "source_type": "prompt",
            "content_filter_raw": [],
            "blocked": false
        }
    ],
    "output": [
        {
            "execution": "server",
            "type": "tool_search_call",
            "arguments": {
                "paths": [
                    "crm"
                ]
            },
            "id": "tsc_04a644e35c4f876d0069d5ee82bacc8194be92a9b2487c4027",
            "status": "completed"
        },
        {
            "execution": "server",
            "type": "tool_search_output",
            "tools": [
                {
                    "description": "CRM tools for customer lookup and order management.",
                    "type": "namespace",
                    "tools": [
                        {
                            "description": "List open orders for a customer ID.",
                            "type": "function",
                            "defer_loading": true,
                            "name": "list_open_orders",
                            "strict": true,
                            "parameters": {
                                "type": "object",
                                "required": [
                                    "customer_id"
                                ],
                                "additionalProperties": false,
                                "properties": {
                                    "customer_id": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    ],
                    "name": "crm"
                }
            ],
            "id": "tso_04a644e35c4f876d0069d5ee82c86c819491796ba0edb3faf1",
            "status": "completed"
        },
        {
            "type": "function_call",
            "call_id": "call_gIstyUK0Wj4G6n79UpI8EhT8",
            "name": "list_open_orders",
            "namespace": "crm",
            "arguments": "{\"customer_id\":\"CUST-12345\"}",
            "id": "fc_04a644e35c4f876d0069d5ee83642481948f8f7e0d73831ed7",
            "status": "completed"
        }
    ],
    "top_p": 0.98,
    "completed_at": 1775627907,
    "frequency_penalty": 0.0,
    "parallel_tool_calls": false,
    "background": false,
    "temperature": 1.0,
    "tool_choice": "auto",
    "model": "MaaS_GP_5.4_mini_20260317",
    "service_tier": "auto",
    "id": "resp_04a644e35c4f876d0069d5ee81f9d8819499ad10d4b53bf86e",
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "truncation": "disabled",
    "object": "response",
    "status": "completed"
}

测试 MaaS_GP_5.4 及 MaaS_GP_5.4_mini计算机工具使用

1) 首轮请求(启动 computer loop)
你会在返回里看到 computer_call(通常先要 screenshot,或返回一批 actions[])。

curl https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses \
  -H "Authorization: Bearer {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MaaS_GP_5.4",
    "input": "请用浏览器打开 https://example.com ,然后告诉我页面标题。",
    "tools": [
      { "type": "computer" }
    ],
    "parallel_tool_calls": false
  }'



 2) 执行动作后,回传截图(关键)
假设你已经:
执行了模型返回的 actions[]
截到最新屏幕,并得到 BASE64_PNG
然后继续同一个会话:
curl https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses \
  -H "Authorization: Bearer {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MaaS_GP_5.4",
    "previous_response_id": "resp_xxx",
    "input": [
      {
        "type": "computer_call_output",
        "call_id": "call_xxx",
        "output": {
          "type": "input_image",
          "image_url": "data:image/png;base64,BASE64_PNG",
          "detail": "original"
        }
      }
    ],
    "tools": [
      { "type": "computer" }
    ],
    "parallel_tool_calls": false
  }'

3) 重复直到不再返回 computer_call
继续执行 actions[]
再截图
再发一轮 computer_call_output
直到输出变为普通文本结果/最终答案

background(后台模式)

MaaS_GP_5.4_mini 和 MaaS_GP_5.4_nano都支持background模式

background异步请求示例如下:

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "background": true,
    "model": "MaaS_GP_5.4_nano",
    "input": "问题A:回答A."
  }'

响应结果示例如下:

{
    "top_logprobs": 0,
    "metadata": {},
    "presence_penalty": 0.0,
    "reasoning": {
        "effort": "none"
    },
    "created_at": 1773899632,
    "store": true,
    "tools": [],
    "output": [],
    "top_p": 0.98,
    "frequency_penalty": 0.0,
    "parallel_tool_calls": true,
    "background": true,
    "temperature": 1.0,
    "tool_choice": "auto",
    "model": "MaaS_GP_5.4_nano_20260317",
    "service_tier": "auto",
    "id": "resp_0bd529239ed0ff590069bb8f70a8448193976feb98de696212",
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "truncation": "disabled",
    "object": "response",
    "status": "queued"
}

获取异步请求的结果示例如下:

curl --location --request GET 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/responses/resp_0bd529239ed0ff590069bb8f70a8448193976feb98de696212' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{}'

返回示例

{
    "top_logprobs": 0,
    "metadata": {},
    "presence_penalty": 0.0,
    "reasoning": {
        "effort": "none"
    },
    "usage": {
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "input_tokens": 24,
        "output_tokens_details": {
            "reasoning_tokens": 0
        },
        "total_tokens": 352,
        "output_tokens": 328
    },
    "created_at": 1775629269,
    "store": true,
    "tools": [],
    "content_filters": [
        {
            "content_filter_results": {
                "self_harm": {
                    "severity": "safe",
                    "filtered": false
                },
                "jailbreak": {
                    "filtered": false,
                    "detected": false
                },
                "hate": {
                    "severity": "safe",
                    "filtered": false
                },
                "sexual": {
                    "severity": "safe",
                    "filtered": false
                },
                "violence": {
                    "severity": "safe",
                    "filtered": false
                }
            },
            "content_filter_offsets": {
                "end_offset": 870,
                "start_offset": 0,
                "check_offset": 0
            },
            "source_type": "prompt",
            "content_filter_raw": [],
            "blocked": false
        }
    ],
    "output": [
        {
            "phase": "final_answer",
            "role": "assistant",
            "type": "message",
            "content": [
                {
                    "annotations": [],
                    "type": "output_text",
                    "logprobs": [],
                    "text": "Aye, they be *optional* in JavaScript, matey—mostly.\n\n- **Semicolons (`;`) aren’t required** because JavaScript has *automatic semicolon insertion* (ASI). If the parser can figure out where a statement ends, it’ll chuck in a semicolon for ye.\n- **But they’re not optional in every case**, because ASI can’t always read yer mind—and that’s when bugs be born.\n\n### When semicolons matter (gotchas)\nIf ye skip ’em, ASI can sometimes insert them in the “wrong” spot. Two classic troublemakers:\n\n1) **Line breaks before `(`, `[` , `+`, `-`, etc.**\n```js\nreturn\n{\n  name: \"Jack\"\n}\n```\nThat can turn into something like:\n```js\nreturn; \n{\n  name: \"Jack\"\n}\n```\n\n2) **Starting a line with `(` or `[` after a statement**\n```js\nlet x = 1\n(2 + 3)\n```\nASI might treat `(2 + 3)` as a new statement, not part of the previous expression.\n\n### The practical rule o’ thumb\n- **You can omit semicolons**, especially if ye use a linter/formatter like **Prettier** and follow consistent style.\n- Still, **adding semicolons often makes code more predictable**, and many folks keep ’em for safety.\n\nIf ye tell me what style guide ye follow (Airbnb? Standard? Prettier?), I can recommend the usual approach."
                }
            ],
            "id": "msg_06b47ab625f269470069d5f3deaa88819488b5ff47f694bf40",
            "status": "completed"
        }
    ],
    "top_p": 0.98,
    "completed_at": 1775629294,
    "frequency_penalty": 0.0,
    "parallel_tool_calls": true,
    "background": true,
    "temperature": 1.0,
    "tool_choice": "auto",
    "model": "MaaS_GP_5.4_nano_20260317",
    "service_tier": "auto",
    "id": "resp_06b47ab625f269470069d5f3d5d2b8819494932d297a151aa5",
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "truncation": "disabled",
    "object": "response",
    "status": "completed"
}

注:会话保持策略

GP response api存在多轮对话如果跨账号会存在请求失败的问题。为了解决这个问题,可以在请求的header中添加 X-Conversation-Id,值是会话id,同一轮对话id需要一致。这个会话保持也是有时间限制的,最长保持30分钟。

response请求

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{your endpoint}/responses' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'X-Conversation-Id: conversation-test1' \
--header 'Content-Type: application/json' \
--data-raw '{
  "input": "再讲一个脑经急转弯,附带答案。综合返回所有的。",
  "previous_response_id": "resp_04825fd1c08c48820069c12ebdd7948190ac42abb8234f1a83",
  "stream": true
}'

Chat completion

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'X-Conversation-Id: conversation-test1' \
--header 'Content-Type: application/json' \
--data-raw '{

    "messages": [
        {
            "role":"user",
            "content":"hi"
        }
    ]
}'