Endpoints & Protocols
Coding Plan model calls and plan capabilities share the same subscription endpoints, compatible with both the OpenAI and Anthropic protocols, authenticated with a cp_live_ subscription API key.
Base URL shared by all endpoints:
https://www.silvamux.com/api/coding-plan/v1
Use the Authorization: Bearer cp_live_... header; the Anthropic-compatible entry also accepts x-api-key: cp_live_.... cp_live_ can only call the subscription endpoints below; using it on regular endpoints (such as /api/v1/chat/completions) returns 403 CODING_PLAN_KEY_NOT_ALLOWED; conversely, a regular sk_live_ key cannot call the subscription endpoints.
Chat (OpenAI compatible)
/api/coding-plan/v1/chat/completionsCoding Plan 对话(OpenAI 兼容)
Coding Plan 订阅专用 OpenAI Chat Completions 兼容入口,使用 cp_live_ 订阅 Key (Bearer 或 x-api-key)鉴权,按套餐点数计费,不消耗账户 Token 余额。
Request structure
The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.
POST https://www.silvamux.com/api/coding-plan/v1/chat/completions
Authorization: Bearer $SILVAMUX_CP_API_KEY
Content-Type: application/jsonRequest body
application/json · OpenAIChatRequest · Required
| Field | Type | Required | Description |
|---|---|---|---|
max_tokens | integer | No | 生成的最大 token 数;达到限制时输出可能被截断。 |
messages | array<Message> | Yes | 对话消息列表(按时间顺序,至少一条),提供完整上下文。 |
messages.content | string | array<ContentPart> | Yes | 消息内容:纯文本字符串或多模态分段数组(图片 / 音频)。不能只包含 system 或 assistant 消息。 |
messages.name | string | No | 参与者名称(可选)。 |
messages.role | string (system | user | assistant | tool) | Yes | 消息角色:system 设定行为与人设,user 用户输入,assistant 模型回复,tool 工具执行结果。 |
messages.tool_call_id | string | No | role=tool 时对应的工具调用 ID。 |
messages.tool_calls | array<ToolCall> | No | 模型发起的工具调用(出现在 assistant 历史消息中)。 |
messages.tool_calls.function | object | Yes | — |
messages.tool_calls.function.arguments | string | Yes | JSON 编码的函数参数。 |
messages.tool_calls.function.name | string | Yes | 函数名。 |
messages.tool_calls.id | string | Yes | 工具调用 ID。 |
messages.tool_calls.type | string (function) | Yes | — |
model | string | Yes | SilvaMux 模型调用名(id 或 alias)。从模型广场模型详情页复制;账号最终可用范围还受组织权限影响。 |
response_format | object | No | 输出格式:text(默认,普通文本)或 json_object(JSON 模式)。 |
response_format.type | string (text | json_object) | No | — |
stop | string | array<string> | No | 停止词:生成文本出现这些字符串时立即停止,最多 4 个。 |
stream | boolean | No | 是否启用流式输出(SSE)。false:完整生成后一次性返回;true:实时返回生成内容,结束时以 data: [DONE] 标记(客户端不应仅依赖该标记判断完成)。;Default: false |
temperature | number | No | 采样温度,控制输出随机性:值越高越发散,越低越稳定。建议只调整 temperature 或 top_p 之一。 |
tool_choice | string (auto | none) | object | No | 工具选择策略:auto(默认,模型自行决定)/ none(禁用)/ 指定函数对象。 |
tools | array<Tool> | No | 可供模型调用的函数定义列表(Function Calling)。 |
tools.function | object | Yes | — |
tools.function.description | string | No | 函数用途描述,帮助模型决定是否调用。 |
tools.function.name | string | Yes | 函数名。 |
tools.function.parameters | object | No | 函数参数的 JSON Schema。 |
tools.type | string (function) | Yes | — |
top_p | number | No | 核采样参数,temperature 的替代方案。 |
user | string | No | 终端用户标识符,用于滥用检测。 |
Response
200OpenAI Chat JSON 或 SSE 响应。
application/json · OpenAIChatResponse
| Field | Type | Description |
|---|---|---|
choices | array<OpenAIChatChoice> | 候选响应列表。 |
choices.finish_reason | string (stop | length | tool_calls | content_filter) | 结束原因:stop 自然结束;length 达到 max_tokens;tool_calls 需执行工具;content_filter 触发内容过滤。 |
choices.index | integer | 候选序号。 |
choices.message | object | 助手消息。 |
choices.message.content | string | 生成的文本内容;仅工具调用时可为空。 |
choices.message.reasoning_content | string | 思考过程内容(支持思考模式的模型返回)。 |
choices.message.role | string (assistant | tool) | — |
choices.message.tool_calls | array<ToolCall> | 模型发起的工具调用。 |
choices.message.tool_calls.function | object | — |
choices.message.tool_calls.id | string | 工具调用 ID。 |
choices.message.tool_calls.type | string (function) | — |
created | integer | 创建时间(Unix 秒)。 |
id | string | 请求 ID。 |
model | string | 实际使用的模型名。 |
object | string | 对象类型(如 chat.completion)。 |
usage | Usage | Token 用量统计;兼容入口可能透传厂商扩展字段。 |
usage.completion_tokens | integer | 输出 token 数。 |
usage.prompt_tokens | integer | 输入 token 数。 |
usage.total_tokens | integer | 总 token 数。 |
defaultOpenAI 兼容错误。
application/json · OpenAIError
| Field | Type | Description |
|---|---|---|
error | object | — |
error.code | string | integer | — |
error.message | string | — |
error.type | string | — |
Chat (Anthropic compatible)
/api/coding-plan/v1/messagesCoding Plan 对话(Anthropic 兼容)
Coding Plan 订阅专用 Anthropic Messages 兼容入口,使用 cp_live_ 订阅 Key (Bearer 或 x-api-key)鉴权,按套餐点数计费,不消耗账户 Token 余额。
Request structure
The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.
POST https://www.silvamux.com/api/coding-plan/v1/messages
Authorization: Bearer $SILVAMUX_CP_API_KEY
Content-Type: application/jsonRequest body
application/json · AnthropicRequest · Required
| Field | Type | Required | Description |
|---|---|---|---|
max_tokens | integer | Yes | 单次响应允许生成的最大 token 数。 |
messages | array<AnthropicMessage> | Yes | 对话消息列表(按时间顺序)。 |
messages.content | string | array<AnthropicContentBlock> | Yes | 消息内容:字符串或内容块数组。 |
messages.role | string (user | assistant) | Yes | 消息角色(system 是顶层参数,不是消息角色)。 |
metadata | object | No | 请求元数据。 |
metadata.user_id | string | No | 终端用户标识符。 |
model | string | Yes | SilvaMux 模型调用名(id 或 alias)。从模型广场模型详情页复制。 |
stop_sequences | array<string> | No | 停止序列列表。 |
stream | boolean | No | 是否启用流式输出(SSE)。;Default: false |
system | string | array<AnthropicTextBlock> | No | 系统提示(顶层参数)。 |
temperature | number | No | 采样温度,控制输出随机性。 |
tool_choice | AnthropicToolChoice | No | — |
tool_choice.name | string | No | type=tool 时指定的工具名。 |
tool_choice.type | string (auto | any | tool) | Yes | auto 模型自行决定;any 必须调用其中之一;tool 指定工具。 |
tools | array<AnthropicTool> | No | 可用工具列表。 |
tools.description | string | No | 工具用途描述。 |
tools.input_schema | object | Yes | 入参的 JSON Schema。 |
tools.name | string | Yes | 工具名。 |
top_k | integer | No | 仅从概率前 k 的候选中采样。 |
top_p | number | No | 核采样参数,temperature 的替代方案。 |
Response
200Anthropic Messages JSON 或 SSE 响应。
application/json · AnthropicMessageResponse
| Field | Type | Description |
|---|---|---|
content | array<AnthropicTextBlock | AnthropicToolUseBlock> | 响应内容块列表。 |
id | string | 消息 ID。 |
model | string | 实际使用的模型名。 |
role | string (assistant) | — |
stop_reason | string (end_turn | max_tokens | stop_sequence | tool_use) | 结束原因。 |
stop_sequence | string | 命中的停止序列。 |
type | string (message) | — |
usage | object | — |
usage.input_tokens | integer | 输入 token 数。 |
usage.output_tokens | integer | 输出 token 数。 |
defaultAnthropic 兼容错误。
application/json · AnthropicError
| Field | Type | Description |
|---|---|---|
error | object | — |
error.message | string | — |
error.type | string | — |
type | string (error) | — |
Model list
/api/coding-plan/v1/modelsCoding Plan 模型列表
返回 Coding Plan 可用的聚合模型名。未鉴权时返回公开模型,携带 cp_live_ Key 时 按组织模型权限过滤。
Request structure
The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.
GET https://www.silvamux.com/api/coding-plan/v1/models
Authorization: Bearer $SILVAMUX_CP_API_KEYResponse
200OpenAI 兼容模型列表。
application/json · ModelList
| Field | Type | Description |
|---|---|---|
data | array<object> | — |
data.created | integer | — |
data.id | string | 可直接填入请求 model 字段的聚合模型调用名。 |
data.object | string (model) | — |
data.owned_by | string (system) | — |
object | string (list) | — |
defaultOpenAI 兼容错误。
application/json · OpenAIError
| Field | Type | Description |
|---|---|---|
error | object | — |
error.code | string | integer | — |
error.message | string | — |
error.type | string | — |
For the full setup steps of each tool, see Claude Code, OpenCode, Cursor, Codex, ZCode, TRAE, and CodeBuddy. The available models follow the model list endpoint and the Model Plaza.