MaaS_Cl_Sonnet_5_20240620
Model Overview
| item | value |
|---|---|
| Model ID (model) | claude-sonnet-5 |
| Status | Active (Latest); Released on 2026-06-30, to be retired no earlier than 2027-06-30 |
| context window | 1M tokens (default value, i. e. the maximum, with no smaller context variants available) |
| Maximum Input | The source document does not provide separate clarification (the 1M tokens mentioned in the context refers to the aggregate of input and output tokens) |
| Maximum Output | 128K tokens (up to 300K under the Message Batches API with the output-300k-2026-03-24 beta) |
| input modality | Text, Image |
| output modality | Text |
| thinking pattern | Adaptive (enabled by default, the model will still perform reasoning even if the request does not carry the thinkingfield) |
| default effort | high |
| Knowledge Cutoff | Reliable knowledge as of January 2026; training data as of January 2026 |
| Tokenizer | New tokenizer: The number of tokens in the same segment of text is approximately 30% higher than that of Sonnet 4.6 |
Request Protocol
https
Header
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | string | Yes | application/json |
| Authorization | string | Yes | Bearer ${your_AK} |
Anthropic Messages
Request URL
POST https://genaiapi.cloudsway.net/{endpoint}/v1/messages
Header (Additional to This Agreement)
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| anthropic-version | string | Yes | The API version number required by the origin server, which is currently 2023-06-01 |
Request Body Parameters
| Parameter Name | Secondary Parameters | Three-level parameters | Type | Required | Description |
|---|---|---|---|---|---|
| model | - | - | string | Yes | Fixed as MaaS_Cl_Sonnet_5_20240620 (Original vendor model: claude-sonnet-5) |
| max_tokens | - | - | number | Yes | Output hard cap, including the total of thinking and main text (this model has thinking enabled by default, please adjust this value upward as needed); the model may stop naturally in advance; set it to 0to warm up the prompt cache without generating a response; minimum value: 0 |
| messages | - | - | array of MessageParam | Yes | Input messages: the maximum number per single request is 100,000; consecutive messages from the same role will be merged |
| role | - | string | Yes | user / assistant / system |
|
| content | - | string or array of ContentBlockParam | Yes | The string is[{"type":"text", "text":". .."}]for short. |
|
| type | string | Yes | text / image / document / search_result / thinking / redacted_thinking / tool_use / tool_result / server_tool_use / web_search_tool_result / web_fetch_tool_result |
||
| text | string | Conditions | type= textText content when (minLength 1) |
||
| source | object | Conditions | Source for type=image/document: base64 (data + media_type), url, or file_id; image media_type supports image/jpeg/image/png/image/gif/image/webp (Sonnet 5 row) |
||
| id / name / input | string / string / map | Conditions | type= tool_use: Tool call ID, tool name (1–200 characters), and input parameters |
||
| tool_use_id / content | string / string or array | Conditions | type= tool_result: corresponds to the id of tool_use and the postback content (Sonnet 5 row) |
||
| signature / thinking | string / string | Conditions | type= thinking: The signature and thinking text returned in the previous round must be posted back as-is; any modification will result in a 400 response invalid_request_error |
||
| data | string | Conditions | type= redacted_thinkingencrypted content, postback as-is |
||
| cache_control | object | No | Create a cache breakpoint at the content block:{"type":"ephemeral", "ttl":"5m"\|"1h"}, the default ttl is 5m |
||
| citations | array | No | Text citation blocks (char_location / page_location / content_block_location / web_search_result_location / search_result_location) (Sonnet 5 row) | ||
| system | - | - | string or array of TextBlockParam | No | System prompt; the Messages API does not have systemrole messages, and system prompts are processed via this field (Sonnet 5 row) |
| stream | - | - | boolean | No | Whether to return incrementally via SSE |
| stop_sequences | - | - | array of string | No | Custom stop sequence; when hit, stop_reasonwill be stop_sequence, and the hit sequence will be returned in stop_sequence |
| tools | - | - | array of ToolUnion | No | Tool Definition (Client tools: name, description, input_schema; server-side tools are also acceptable, such as web_search / web_fetch / code_execution / text_editor / json, as well as browser use and computer_toolset_20260801that are supported by this model but not by version 4.6) |
| name | - | string | Yes | Tool Name (1–128 characters, ^[a-zA-Z0-9_-]{1,128}$) |
|
| description | - | string | No | Tool description, please provide as detailed as possible | |
| input_schema | - | object | Yes | Tool input parameters JSON Schema (type: "object", properties, required) |
|
| cache_control / strict / defer_loading / allowed_callers / input_examples / eager_input_streaming | - | Respective types | No | cache breakpoint, strong parameter validation, lazy loading, allowed callers, input parameter examples, input parameter streaming | |
| tool_choice | - | - | object | No | {"type":"auto"} / {"type":"any"} / {"type":"tool","name":"..."} / {"type":"none"}; each branch can carry disable_parallel_tool_use (default false) (Sonnet 5 row) |
| thinking | - | - | object | No | The only valid values for this model are{"type":"adaptive"}(default behavior, can be accompanied by display: summarized| omitted) and{"type":"disabled"}(disable reasoning);{"type":"enabled", "budget_tokens": N}has been removed, and a 400 error will be returned if it is passed. |
| output_config | - | - | object | No | effort: low/ medium/ high (default, equivalent to omitting the parameter) / xhigh/ max;do not use adaptiveas the value for effort. format: the Structured Outputs format{"type":"json_schema", "schema":{. ..}}. This model does not support modifying effort mid-generation on a per-message basis (a beta feature exclusive to other model variants) |
| metadata | - | - | object | No | user_id: External user identifier (UUID/hash recommended, max. 512 characters; do not include name/email/phone number) |
| service_tier | - | - | string | No | autoor standard_only; note that this model does not support Priority Tier |
| container | - | - | object or string | No | Container reuse identifier; the object form can include idand skills (up to 20 entries: skill_id+ type: anthropic/ custom+ version) (Sonnet 5 row) |
| cache_control | - | - | object | No | Top-level cache control, automatically set a cache breakpoint for the last cacheable block |
| inference_geo | - | - | string | No | Region for inference processing; if left unspecified, the workspace default will be used default_inference_geo |
| temperature | - | - | number | No | This model returns 400 for non-default values; please delete this parameter and use system prompts to guide the style |
| top_p | - | - | number | No | This model returns 400 for non-default values; please delete this parameter |
| top_k | - | - | number | No | This model returns 400 for non-default values; please delete this parameter |
Request Example
curl -X POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${your_AK}' \
-H 'anthropic-version: 2023-06-01' \
-d '{
"model": "MaaS_Cl_Sonnet_5_20240620",
"max_tokens": 4096,
"messages": [{"role": "user", "content": "Hello, tell me about yourself"}]
}'
Control Thinking and Gears (Exclusive Terminology for This Model)
# Disable thinking (enabled by default)
-d '{
"model": "MaaS_Cl_Sonnet_5_20240620",
"max_tokens": 4096,
"thinking": {"type": "disabled"},
"messages": [{"role": "user", "content": "Translate the following sentence into English: The weather is nice today"}]
}'
# Increase thinking depth (effort replaces budget_tokens from the 4.6 era)
-d '{
"model": "MaaS_Cl_Sonnet_5_20240620",
"max_tokens": 32768,
"thinking": {"type": "adaptive"},
"output_config": {"effort": "xhigh"},
"messages": [{"role": "user", "content": "Design a distributed rate-limiting solution and provide a trade-off analysis"}]
}'
Response Example
{
"id": "msg_01AbCdEfGhIjKlMnOpQrStUv",
"type": "message",
"role": "assistant",
"model": "MaaS_Cl_Sonnet_5_20240620",
"content": [{"type": "text", "text": "Hello! I'm Claude, happy to help you."}],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {"input_tokens": 16, "output_tokens": 28}
}
Example of Streaming Request
curl -X POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${your_AK}' \
-H 'anthropic-version: 2023-06-01' \
-d '{
"model": "MaaS_Cl_Sonnet_5_20240620",
"max_tokens": 4096,
"stream": true,
"messages": [{"role": "user", "content": "Hello, tell me about yourself"}]
}'
SDK Calling Method
from anthropic import Anthropic
client = Anthropic(
api_key="${your_AK}",
base_url="https://genaiapi.cloudsway.net/{endpoint}/v1",
)
message = client.messages.create(
model="MaaS_Cl_Sonnet_5_20240620",
max_tokens=4096,
output_config={"effort": "medium"},
messages=[{"role": "user", "content": "Hello, tell me about yourself"}],
)
print(message.content[0].text)
OpenAI Chat Completions
Origin server note: This protocol is provided by the official Anthropic OpenAI SDK compatibility layer, designed to "facilitate rapid testing and model capability comparison", and is not a long-term/production-grade solution; for full capabilities (PDF processing, citations, reasoning process, prompt cache), please use the native Messages protocol.
Request URL
POST https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions
Request Body Parameters
| Parameter Name | Secondary Parameters | Type | Required | Description |
|---|---|---|---|---|
| model | - | string | Yes | Fixed as MaaS_Cl_Sonnet_5_2024062 |
| messages | - | array | Yes | Dialogue messages;rolesupports system (or developer, which will be promoted and concatenated as the first system prompt), user, assistant, tool, function |
| content | string or array | Yes | user supports string, text, image_url (url);image_url. detail, input_audio, fileare ignored. assistant supports string, text;refusalis ignored |
|
| tool_calls | array | No | Tool invocation for assistant;function_callis also supported. |
|
| tool_call_id | string | Conditions | role= tool/ functionis mandatory |
|
| max_tokens | - | integer | No | Fully supported (including both the thinking process and the main text in total) |
| max_completion_tokens | - | integer | No | Fully supported |
| stream | - | boolean | No | Fully supported |
| stream_options | - | object | No | Fully supported |
| stop | - | string or array | No | Non-blank stop-write sequence is valid |
| n | - | integer | No | Must be 1 |
| tools | - | array | No | tools[n]. function's name/ description/ parametersare fully supported;strictis ignored (use native Structured Outputs for strict validation) |
| functions | - | array | No | Same as tools (OpenAI has deprecated this field, and it is recommended to use tools instead) |
| parallel_tool_calls | - | boolean | No | Fully supported |
| thinking | - | object | No | passed in via the extension field of the compatibility layer;this model only accepts{"type":"adaptive"}or{"type":"disabled"}, passing{"type":"enabled", "budget_tokens": N}will return 400; the compatibility layer does not return Claude's detailed reasoning process |
| temperature | - | number | No | The compatibility layer documentation describes this as 0–1, however this model returns 400 for non-default values, please remove this parameter |
| top_p | - | number | No | The compatibility layer documentation states full support, however this model returns 400 for non-default values, please remove this parameter |
| logprobs / top_logprobs | - | - | No | Ignored |
| metadata | - | object | No | Ignored |
| response_format | - | object | No | Ignored (use native Structured Outputs for JSON output) |
| prediction / presence_penalty / frequency_penalty / seed / service_tier / audio / logit_bias / store / user / modalities / reasoning_effort | - | - | No | are all ignored |
Request Example
curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${your_AK}' \
-d '{
"model": "MaaS_Cl_Sonnet_5_20240620",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, tell me about yourself"}
]
}'
Response Example
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1789000000,
"model": "MaaS_Cl_Sonnet_5_20240620",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {"role": "assistant", "content": "Hello! I'm Claude, happy to help you."}
}
],
"usage": {"prompt_tokens": 21, "completion_tokens": 19, "total_tokens": 40}
}
origin server description: compatibility layer
choices[]always has a length of 1;usage. completion_tokens_details,usage. prompt_tokens_details,logprobs,service_tier,system_fingerprint,choices[]. message. refusal,choices[]. message. audioare always empty.
Example of Streaming Request
curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${your_AK}' \
-d '{
"model": "MaaS_Cl_Sonnet_5_20240620",
"stream": true,
"messages": [{"role": "user", "content": "Hello, tell me about yourself"}]
}'
SDK Calling Method
from openai import OpenAI
client = OpenAI(
api_key="${your_AK}",
base_url="https://genaiapi.cloudsway.net/v1/ai/{endpointPath}",
)
response = client.chat.completions.create(
model="MaaS_Cl_Sonnet_5_20240620",
messages=[{"role": "user", "content": "Hello, tell me about yourself"}],
)
print(response.choices[0].message.content)
Three migration tips (origin server is clear, most likely to be encountered when customers access the service):
① Please stop including temperature/ top_p/ top_k; non-default values will trigger a 400 error;
② thinkingor adaptiveor disabled; the legacy combination of enabled+ budget_tokenswill trigger a 400 error, and the thinking depth has been replaced with output_config. effort;
③ The new tokenizer increases the token count for the same text by approximately 30%, so the max_tokensoriginally tuned based on 4.6 may cause truncation, and the token-based quota and cost need to be recalculated (note: security interception returns 200 with stop_reason: "refusal", not an error code).
MaaS_Cl_Sonnet_4.6_20240620
Model Overview
| item | value |
|---|---|
| Model ID (model) | claude-sonnet-4-6 |
| Status | Active (Legacy); released on 2026-02-17, to be retired no earlier than 2027-02-17 |
| context window | 1M tokens |
| Maximum Input | The source document does not provide separate clarification (the 1M tokens mentioned in the context refers to the aggregate of input and output tokens) |
| Maximum Output | 128K tokens (up to 300K under the Message Batches API with the output-300k-2026-03-24 beta) |
| input modality | Text, Image |
| output modality | Text |
| thinking pattern | Adaptive (extended mode is deprecated) |
| default effort | high |
| Knowledge Cutoff | Reliable knowledge as of August 2025; training data as of January 2026 |
Request Protocol
https
Header
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | string | Yes | application/json |
| Authorization | string | Yes | Bearer ${your_AK} |
Anthropic Messages
Request URL
POST https://genaiapi.cloudsway.net/{endpoint}/v1/messages
Header (Additional to This Agreement)
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| anthropic-version | string | Yes | The API version number required by the origin server, which is currently 2023-06-01 |
Request Body Parameters
| Parameter Name | Secondary Parameters | Three-level parameters | Type | Required | Description |
|---|---|---|---|---|---|
| model | - | - | string | Yes | Fixed as MaaS_Cl_Sonnet_4.6_20240620 (Original vendor model: claude-sonnet-4-6) |
| max_tokens | - | - | number | Yes | The maximum number of tokens to generate; the model may stop naturally before reaching this limit; set this to 0to warm up the prompt cache without generating a response; different models have different upper limits (minimum value: 0) |
| messages | - | - | array of MessageParam | Yes | Enter messages: the maximum number per single request is 100,000; consecutive messages from the same role will be merged; if the last message is from the assistant role, the response will be continued from it |
| role | - | string | Yes | user / assistant / system |
|
| content | - | string or array of ContentBlockParam | Yes | The string is[{"type":"text", "text":". .."}]for short. (Sonnet 4.6 row) |
|
| type | string | Yes | Content block type: text / image / document / search_result / thinking / redacted_thinking / tool_use / tool_result / server_tool_use / web_search_tool_result / web_fetch_tool_result |
||
| text | string | Conditions | type= textText content when (minLength 1) |
||
| source | object | Conditions | Source for type=image/document: base64 (data + media_type), url, or file_id; image media_type supports image/jpeg/image/png/image/gif/image/webp |
||
| id / name / input | string / string / map | Conditions | type= tool_use: tool call ID (^[a-zA-Z0-9_-]+$), tool name (1–200 characters), and input parameters |
||
| tool_use_id / content | string / string or array | Conditions | type= tool_result: corresponds to the id of the corresponding tool_use and the postback content (which may contain blocks such as text, image, search_result, document, and tool_reference) |
||
| signature / thinking | string / string | Conditions | type= thinking: The signature and thinking text returned in the previous round must be posted back as-is; any modification will result in a 400 invalid_request_error |
||
| data | string | Conditions | type= redacted_thinkingencrypted content at the time, and perform postback as-is |
||
| cache_control | object | No | Create a cache breakpoint for this content block: `{"type":"ephemeral", "ttl":"5m" | ||
| citations | array | No | Text citation blocks (char_location / page_location / content_block_location / web_search_result_location / search_result_location) | ||
| system | - | - | string or array of TextBlockParam | No | System prompt; the Messages API does not have systemrole messages, so the system prompt uses this field |
| stream | - | - | boolean | No | Whether to return results incrementally via SSE (for details about the origin server, please refer to the streaming documentation) |
| stop_sequences | - | - | array of string | No | Custom stop sequence; when triggered, the stop_reasonwill be stop_sequence, and the matched sequence will be returned in the stop_sequencefield |
| tools | - | - | array of ToolUnion | No | Tool Definition (Client tools: name, description, input_schema; server-side tools such as versioned tool types like web_search / web_fetch / code_execution / text_editor / json are also supported) |
| name | - | string | Yes | Tool Name (1–128 characters, ^[a-zA-Z0-9_-]{1,128}$) |
|
| description | - | string | No | Tool description, please provide as detailed as possible | |
| input_schema | - | object | Yes | Tool input parameters JSON Schema (type: "object", properties, required) |
|
| cache_control / strict / defer_loading / allowed_callers / input_examples / eager_input_streaming | - | Respective types | No | cache breakpoint, mandatory validation of input parameter schema, lazy loading, allowed callers, input parameter examples, input parameter streaming | |
| tool_choice | - | - | object | No | Tool Selection:{"type":"auto"}(decided by the model itself) /{"type":"any"}(mandatory tool) /{"type":"tool", "name":". .."}(specified tool) /{"type":"none"}(tool disabled); each branch can carry disable_parallel_tool_use (default is false, when set to true, tool calls are limited to at most / exactly once) |
| thinking | - | - | object | No | Thinking configuration, choose one of three: {"type":"enabled","budget_tokens":N,"display":"summarized"\|"omitted"} (budget_tokens >=1024 and less than max_tokens), {"type":"disabled"}, {"type":"adaptive","display":...}; displaydefaults to summarized; when set to omitted, no reasoning content is returned, but the signature is retained to enable multi-turn continuation. |
| output_config | - | - | object | No | Output configuration: effort (low/medium/high/xhigh/max), format (Structured Outputs {"type":"json_schema","schema":{...}}) |
| metadata | - | - | object | No | Request metadata: user_id (external user identifier, uuid/hash recommended, maximum length 512, do not include name/email/phone number) |
| service_tier | - | - | string | No | auto (use priority capacity when available) or standard_only |
| container | - | - | object or string | No | Container reuse identifier; the object form can include idand skills (up to 20 entries, each consisting of skill_id+ type: anthropic/ custom+ version) |
| cache_control | - | - | object | No | Top-level cache control, which automatically sets a cache breakpoint for the last cacheable block in a request |
| inference_geo | - | - | string | No | Region for inference processing; if left unspecified, the workspace default will be used default_inference_geo |
Request Example
curl -X POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${your_AK}' \
-H 'anthropic-version: 2023-06-01' \
-d '{
"model": "MaaS_Cl_Sonnet_4.6_20240620",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, tell me about yourself"}]
}'
Response Example
{
"id": "msg_01XyZabcdEFghijklMNOpqr",
"type": "message",
"role": "assistant",
"model": "MaaS_Cl_Sonnet_4.6_20240620",
"content": [{"type": "text", "text": "Hello! I'm Claude, an AI assistant trained by Anthropic."}],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {"input_tokens": 18, "output_tokens": 32}
}
Example of Streaming Request
curl -X POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${your_AK}' \
-H 'anthropic-version: 2023-06-01' \
-d '{
"model": "MaaS_Cl_Sonnet_4.6_20240620",
"max_tokens": 1024,
"stream": true,
"messages": [{"role": "user", "content": "Hello, tell me about yourself"}]
}'
SDK Calling Method
from anthropic import Anthropic
client = Anthropic(
api_key="${your_AK}",
base_url="https://genaiapi.cloudsway.net/{endpoint}/v1",
)
message = client.messages.create(
model="MaaS_Cl_Sonnet_4.6_20240620",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, tell me about yourself"}],
)
print(message.content[0].text)
OpenAI Chat Completions
Origin server note: This protocol is provided by the official Anthropic OpenAI SDK compatibility layer, designed to "facilitate rapid testing and model capability comparison", and is not a long-term/production-grade solution; for full capabilities (PDF processing, citations, reasoning process, prompt cache), please use the native Messages protocol.
Request URL
POST https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions
Request Body Parameters
| Parameter Name | Secondary Parameters | Type | Required | Description |
|---|---|---|---|---|
| model | - | string | Yes | Fixed as MaaS_Cl_Sonnet_4.6_20240620 (Original vendor model: claude-sonnet-4-6) |
| messages | - | array | Yes | Dialogue messages;rolesupports system (or developer, which will be promoted and concatenated as the first system prompt), user, assistant, tool, function |
| content | string or array | Yes | user supports string, text, image_url (url);image_url. detail, input_audio, fileare ignored. assistant supports string, text;refusalis ignored |
|
| tool_calls | array | No | Tool invocation for assistant;function_callis also supported. |
|
| tool_call_id | string | Conditions | role= tool/ functionis mandatory |
|
| max_tokens | - | integer | No | Fully supported |
| max_completion_tokens | - | integer | No | Fully supported |
| stream | - | boolean | No | Fully supported |
| stream_options | - | object | No | Fully supported |
| temperature | - | number | No | The value ranges from 0 to 1 (inclusive); any value greater than 1 will be truncated to 1. |
| top_p | - | number | No | Fully supported |
| n | - | integer | No | Must be 1 |
| stop | - | string or array | No | Non-blank stop-write sequence is valid |
| tools | - | array | No | tools[n]. function's name/ description/ parametersare fully supported;strictis ignored (use native Structured Outputs if strong validation is required) |
| functions | - | array | No | Same as tools (OpenAI has deprecated this field, and it is recommended to use tools instead) |
| parallel_tool_calls | - | boolean | No | Fully supported |
| thinking | - | object | No | Passed in via the extension field of the compatibility layer:{"type":"enabled", "budget_tokens": 2000}; the compatibility layer does not return Claude's detailed reasoning process |
| logprobs / top_logprobs | - | - | No | Ignored |
| metadata | - | object | No | Ignored |
| response_format | - | object | No | Ignored (use native Structured Outputs for JSON output) |
| prediction / presence_penalty / frequency_penalty / seed / service_tier / audio / logit_bias / store / user / modalities / reasoning_effort | - | - | No | are all ignored |
Request Example
curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${your_AK}' \
-d '{
"model": "MaaS_Cl_Sonnet_4.6_20240620",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, tell me about yourself"}
]
}'
Response Example
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1789000000,
"model": "MaaS_Cl_Sonnet_4.6_20240620",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {"role": "assistant", "content": "Hello! I'm Claude, happy to help you."}
}
],
"usage": {"prompt_tokens": 20, "completion_tokens": 18, "total_tokens": 38}
}
origin server description: compatibility layer
choices[]always has a length of 1;usage. completion_tokens_details,usage. prompt_tokens_details,logprobs,service_tier,system_fingerprint,choices[]. message. refusal,choices[]. message. audioare always empty.
Example of Streaming Request
curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${your_AK}' \
-d '{
"model": "MaaS_Cl_Sonnet_4.6_20240620",
"stream": true,
"messages": [{"role": "user", "content": "Hello, tell me about yourself"}]
}'
SDK Calling Method
from openai import OpenAI
client = OpenAI(
api_key="${your_AK}",
base_url="https://genaiapi.cloudsway.net/v1/ai/{endpointPath}",
)
response = client.chat.completions.create(
model="MaaS_Cl_Sonnet_4.6_20240620",
messages=[{"role": "user", "content": "Hello, tell me about yourself"}],
)
print(response.choices[0].message.content)