https://api.tokenoceans.comAuthorization: Bearer sk-xxxxxxxxxxxxxxxx| Item / 项目 | Value / 说明 |
|---|---|
| Path / 路径 | /v1/chat/completions |
| Method / 方法 | POST |
| Content-Type | application/json |
| Parameter / 参数 | Type / 类型 | Required / 必填 | Description / 说明 |
|---|---|---|---|
| model | string | Yes / 是 | Model name, e.g. deepseek-v4-flash, deepseek-v4-pro, qwen3.6-plus / 模型名称 |
| messages | array | Yes / 是 | List of conversation messages / 对话消息列表 |
| stream | boolean | No / 否 | Enable streaming output, default false / 是否流式输出 |
| temperature | number | No / 否 | Sampling temperature, range 0-2, default 1 / 采样温度 |
| top_p | number | No / 否 | Nucleus sampling, range 0-1, default 1 / 核采样参数 |
| max_tokens | integer | No / 否 | Maximum tokens to generate / 最大生成 token 数 |
| frequency_penalty | number | No / 否 | Frequency penalty, range -2 to 2, default 0 / 频率惩罚 |
| presence_penalty | number | No / 否 | Presence penalty, range -2 to 2, default 0 / 存在惩罚 |
| stop | string/array | No / 否 | Stop sequences / 停止生成的标记 |
| n | integer | No / 否 | Number of completions to generate, default 1 / 生成回复数量 |
| tools | array | No / 否 | Available tools/functions / 可用工具列表 |
| tool_choice | string/object | No / 否 | Tool calling strategy / 工具调用策略 |
| response_format | object | No / 否 | Response format, e.g. {"type": "json_object"} / 响应格式 |
| Field / 字段 | Type / 类型 | Required / 必填 | Description / 说明 |
|---|---|---|---|
| role | string | Yes / 是 | Role: system, user, assistant, tool / 角色 |
| content | string/array | Yes / 是 | Message content, supports text or multimodal array / 消息内容 |
| name | string | No / 否 | Participant name / 参与者名称 |
| tool_calls | array | No / 否 | Tool calls (assistant messages) / 工具调用 |
| tool_call_id | string | No / 否 | Tool call ID (tool messages) / 工具调用 ID |
content is an array / 当 content 为数组时:{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}}
]
}{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1700000000,
"model": "deepseek-v4-pro",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm an AI assistant that can help you with questions, writing, coding, and various other tasks. How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 42,
"total_tokens": 67
}
}data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1700000000,"model":"qwen3.6-plus","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1700000000,"model":"qwen3.6-plus","choices":[{"index":0,"delta":{"content":"Spring"},"finish_reason":null}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1700000000,"model":"qwen3.6-plus","choices":[{"index":0,"delta":{"content":" breeze"},"finish_reason":null}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1700000000,"model":"qwen3.6-plus","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]{
"model": "qwen3.6-plus",
"messages": [
{"role": "user", "content": "What's the weather like in Beijing today?"}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather information for a specified city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}
}
]
}{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"city\": \"Beijing\"}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}| Item / 项目 | Value / 说明 |
|---|---|
| Path / 路径 | /apps/anthropic |
| Method / 方法 | POST |
| Content-Type | application/json |
| Header | Required / 必填 | Description / 说明 |
|---|---|---|
| Authorization | Yes / 是 | Bearer sk-xxxxxxxxxxxxxxxx |
| anthropic-version | No / 否 | API version, e.g. 2023-06-01 / API 版本 |
| Parameter / 参数 | Type / 类型 | Required / 必填 | Description / 说明 |
|---|---|---|---|
| model | string | Yes / 是 | Model name, e.g. qwen3.5-plus, qwen3.6-plus / 模型名称 |
| messages | array | Yes / 是 | List of conversation messages / 对话消息列表 |
| max_tokens | integer | Yes / 是 | Maximum tokens to generate / 最大生成 token 数 |
| stream | boolean | No / 否 | Enable streaming output, default false / 是否流式输出 |
| system | string/array | No / 否 | System prompt / 系统提示词 |
| temperature | number | No / 否 | Sampling temperature, range 0-1, default 1 / 采样温度 |
| top_p | number | No / 否 | Nucleus sampling / 核采样参数 |
| top_k | integer | No / 否 | Top-K sampling / Top-K 采样参数 |
| stop_sequences | array | No / 否 | Stop sequences / 停止序列列表 |
| tools | array | No / 否 | Available tools / 可用工具列表 |
| tool_choice | object | No / 否 | Tool calling strategy / 工具调用策略 |
| metadata | object | No / 否 | Request metadata / 请求元数据 |
| Field / 字段 | Type / 类型 | Required / 必填 | Description / 说明 |
|---|---|---|---|
| role | string | Yes / 是 | Role: user or assistant / 角色 |
| content | string/array | Yes / 是 | Message content, supports text or content block array / 消息内容 |
{"type": "text", "text": "Hello"}{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/png",
"data": "iVBORw0KGgo..."
}
}{
"type": "image",
"source": {
"type": "url",
"url": "https://example.com/image.png"
}
}{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"model": "`qwen3.6-plus",
"content": [
{
"type": "text",
"text": "Hello! I'm qwen3.6-plus, an AI assistant developed by Anthropic. I can help you with various tasks including answering questions, writing, analysis, coding, and more. How can I assist you today?"
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 20,
"output_tokens": 58
}
}event: message_start
data: {"type":"message_start","message":{"id":"msg_abc123","type":"message","role":"assistant","model":"qwen3.6-plus","content":[],"stop_reason":null,"usage":{"input_tokens":15,"output_tokens":0}}}
event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Spring"}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" breeze"}}
event: content_block_stop
data: {"type":"content_block_stop","index":0}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":35}}
event: message_stop
data: {"type":"message_stop"}{
"model": "qwen3.6-plus",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "What's the weather like in Beijing today?"}
],
"tools": [
{
"name": "get_weather",
"description": "Get weather information for a specified city",
"input_schema": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}
]
}{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"model": "qwen3.6-plus",
"content": [
{
"type": "tool_use",
"id": "toolu_abc123",
"name": "get_weather",
"input": {"city": "Beijing"}
}
],
"stop_reason": "tool_use",
"usage": {
"input_tokens": 120,
"output_tokens": 45
}
}{
"model": "qwen3.6-plus",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "What's the weather like in Beijing today?"},
{
"role": "assistant",
"content": [
{
"type": "tool_use",
"id": "toolu_abc123",
"name": "get_weather",
"input": {"city": "Beijing"}
}
]
},
{
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": "toolu_abc123",
"content": "Beijing today: sunny, 22°C, light breeze"
}
]
}
]
}{
"error": {
"message": "Invalid API key provided",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}{
"type": "error",
"error": {
"type": "authentication_error",
"message": "Invalid API key"
}
}| HTTP Status / 状态码 | Description / 说明 |
|---|---|
| 400 | Bad Request — Invalid parameters / 请求参数错误 |
| 401 | Unauthorized — Invalid API Key / 认证失败 |
| 403 | Forbidden — Insufficient permissions / 权限不足 |
| 404 | Not Found — Endpoint does not exist / 接口不存在 |
| 429 | Too Many Requests — Rate limit exceeded / 请求频率超限 |
| 500 | Internal Server Error / 服务器内部错误 |
| 502 | Bad Gateway — Upstream service unavailable / 上游服务不可用 |
| 503 | Service Unavailable / 服务暂时不可用 |