跳转至

MaaS_Cl_Opus_4.8

基础信息

  • 基础URL:https://genaiapi.cloudsway.net

  • API请求端点POST

  • 身份验证:通过HTTP Bearer Token方式验证,需要在请求头中携带API密钥。

参数名 类型 必填 描述
Content-Type string 固定为 application/json
Authorization string Bearer {your_api_key}

核心参数说明

参数 类型 必选 描述
model string 要使用的模型ID
messages array 对话消息列表,包含roleuserassistant)和content
max_tokens integer 生成的最大token数
system string 系统提示词,用于设定助手的行为和背景
temperature number 采样温度,较高的值使输出更随机,较低的值使输出更确定,只支持固定值1
top_p number 核采样参数,模型考虑具有top_p概率质量的token的结果,只支持传固定值0.99
top_k integer 仅从每个步骤中概率最高的K个token中采样,opus 4.8不支持
stream boolean 是否启用流式传输,默认为false
stop_sequences array 自定义停止序列,当模型生成这些序列时停止

请求与响应示例

端点调用/v1/messages

curl --location --request POST 'https://genaiapi.cloudsway.net/{ENDPOINT}/v1/messages' \
--header 'Authorization: Bearer {Your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "max_tokens": 2048,
    "stream": false,
    "messages": [
        {
            "role": "user",
            "content": "证明勾股定律"
        }
    ],
    "thinking": {
        "type": "adaptive"
    }
}'

openai格式端点调用/chat/completions

curl --location --request POST 'https://genaiapi.cloudsway.net/{ENDPOINT}/v1/messages' \
--header 'Authorization: Bearer {Your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "max_tokens": 2048,
    "stream": false,
    "messages": [
        {
            "role": "user",
            "content": "证明勾股定律"
        }
    ],
    "thinking": {
        "type": "adaptive"
    }
}'

openai格式融合调用/chat/completions

curl --location --request POST 'https://genaiapi.cloudsway.net/{ENDPOINT}/v1/messages' \
--header 'Authorization: Bearer {Your AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "MaaS_Cl_Opus_4.8_20260528",
    "stream": false,
    "messages": [
        {
            "role": "user",
            "content": "你是谁"
        }
    ],
    "thinking": {
        "type": "adaptive"
    }
}'

功能介绍

thinking

opus4.8不支持扩展思维预算,传入以下参数会报400

thinking: {"type": "enabled", "budget_tokens": N}

opus4.8只支持Adaptive这一种方式

thinking: {"type": "adaptive"}

最小缓存token

Claude Opus 4.8上的最小可缓存提示长度为1024token,无需更改代码。