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)

POST/api/coding-plan/v1/chat/completions

Coding Plan 对话(OpenAI 兼容)

Coding Plan 订阅专用 OpenAI Chat Completions 兼容入口,使用 cp_live_ 订阅 Key (Bearer 或 x-api-key)鉴权,按套餐点数计费,不消耗账户 Token 余额。

Coding Plan subscription keyUse the Authorization: Bearer cp_live_... header (subscription-only key); x-api-key is also supported.
Confirm the model call name firstFirst filter models that support this endpoint format on the Models page, then open a model detail page to copy its call name. Your account's final availability also depends on organization permissions.

Request structure

The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.

HTTP
POST https://www.silvamux.com/api/coding-plan/v1/chat/completions
Authorization: Bearer $SILVAMUX_CP_API_KEY
Content-Type: application/json

Request body

application/json · OpenAIChatRequest · Required

FieldTypeRequiredDescription
max_tokensintegerNo生成的最大 token 数;达到限制时输出可能被截断。
messagesarray<Message>Yes对话消息列表(按时间顺序,至少一条),提供完整上下文。
messages.contentstring | array<ContentPart>Yes消息内容:纯文本字符串或多模态分段数组(图片 / 音频)。不能只包含 system 或 assistant 消息。
messages.namestringNo参与者名称(可选)。
messages.rolestring (system | user | assistant | tool)Yes消息角色:system 设定行为与人设,user 用户输入,assistant 模型回复,tool 工具执行结果。
messages.tool_call_idstringNorole=tool 时对应的工具调用 ID。
messages.tool_callsarray<ToolCall>No模型发起的工具调用(出现在 assistant 历史消息中)。
messages.tool_calls.functionobjectYes
messages.tool_calls.function.argumentsstringYesJSON 编码的函数参数。
messages.tool_calls.function.namestringYes函数名。
messages.tool_calls.idstringYes工具调用 ID。
messages.tool_calls.typestring (function)Yes
modelstringYesSilvaMux 模型调用名(id 或 alias)。从模型广场模型详情页复制;账号最终可用范围还受组织权限影响。
response_formatobjectNo输出格式:text(默认,普通文本)或 json_object(JSON 模式)。
response_format.typestring (text | json_object)No
stopstring | array<string>No停止词:生成文本出现这些字符串时立即停止,最多 4 个。
streambooleanNo是否启用流式输出(SSE)。false:完整生成后一次性返回;true:实时返回生成内容,结束时以 data: [DONE] 标记(客户端不应仅依赖该标记判断完成)。;Default: false
temperaturenumberNo采样温度,控制输出随机性:值越高越发散,越低越稳定。建议只调整 temperature 或 top_p 之一。
tool_choicestring (auto | none) | objectNo工具选择策略:auto(默认,模型自行决定)/ none(禁用)/ 指定函数对象。
toolsarray<Tool>No可供模型调用的函数定义列表(Function Calling)。
tools.functionobjectYes
tools.function.descriptionstringNo函数用途描述,帮助模型决定是否调用。
tools.function.namestringYes函数名。
tools.function.parametersobjectNo函数参数的 JSON Schema。
tools.typestring (function)Yes
top_pnumberNo核采样参数,temperature 的替代方案。
userstringNo终端用户标识符,用于滥用检测。

Response

200OpenAI Chat JSON 或 SSE 响应。

application/json · OpenAIChatResponse

FieldTypeDescription
choicesarray<OpenAIChatChoice>候选响应列表。
choices.finish_reasonstring (stop | length | tool_calls | content_filter)结束原因:stop 自然结束;length 达到 max_tokens;tool_calls 需执行工具;content_filter 触发内容过滤。
choices.indexinteger候选序号。
choices.messageobject助手消息。
choices.message.contentstring生成的文本内容;仅工具调用时可为空。
choices.message.reasoning_contentstring思考过程内容(支持思考模式的模型返回)。
choices.message.rolestring (assistant | tool)
choices.message.tool_callsarray<ToolCall>模型发起的工具调用。
choices.message.tool_calls.functionobject
choices.message.tool_calls.idstring工具调用 ID。
choices.message.tool_calls.typestring (function)
createdinteger创建时间(Unix 秒)。
idstring请求 ID。
modelstring实际使用的模型名。
objectstring对象类型(如 chat.completion)。
usageUsageToken 用量统计;兼容入口可能透传厂商扩展字段。
usage.completion_tokensinteger输出 token 数。
usage.prompt_tokensinteger输入 token 数。
usage.total_tokensinteger总 token 数。

defaultOpenAI 兼容错误。

application/json · OpenAIError

FieldTypeDescription
errorobject
error.codestring | integer
error.messagestring
error.typestring

Chat (Anthropic compatible)

POST/api/coding-plan/v1/messages

Coding Plan 对话(Anthropic 兼容)

Coding Plan 订阅专用 Anthropic Messages 兼容入口,使用 cp_live_ 订阅 Key (Bearer 或 x-api-key)鉴权,按套餐点数计费,不消耗账户 Token 余额。

Coding Plan subscription keyUse the Authorization: Bearer cp_live_... header (subscription-only key); x-api-key is also supported.
Confirm the model call name firstFirst filter models that support this endpoint format on the Models page, then open a model detail page to copy its call name. Your account's final availability also depends on organization permissions.

Request structure

The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.

HTTP
POST https://www.silvamux.com/api/coding-plan/v1/messages
Authorization: Bearer $SILVAMUX_CP_API_KEY
Content-Type: application/json

Request body

application/json · AnthropicRequest · Required

FieldTypeRequiredDescription
max_tokensintegerYes单次响应允许生成的最大 token 数。
messagesarray<AnthropicMessage>Yes对话消息列表(按时间顺序)。
messages.contentstring | array<AnthropicContentBlock>Yes消息内容:字符串或内容块数组。
messages.rolestring (user | assistant)Yes消息角色(system 是顶层参数,不是消息角色)。
metadataobjectNo请求元数据。
metadata.user_idstringNo终端用户标识符。
modelstringYesSilvaMux 模型调用名(id 或 alias)。从模型广场模型详情页复制。
stop_sequencesarray<string>No停止序列列表。
streambooleanNo是否启用流式输出(SSE)。;Default: false
systemstring | array<AnthropicTextBlock>No系统提示(顶层参数)。
temperaturenumberNo采样温度,控制输出随机性。
tool_choiceAnthropicToolChoiceNo
tool_choice.namestringNotype=tool 时指定的工具名。
tool_choice.typestring (auto | any | tool)Yesauto 模型自行决定;any 必须调用其中之一;tool 指定工具。
toolsarray<AnthropicTool>No可用工具列表。
tools.descriptionstringNo工具用途描述。
tools.input_schemaobjectYes入参的 JSON Schema。
tools.namestringYes工具名。
top_kintegerNo仅从概率前 k 的候选中采样。
top_pnumberNo核采样参数,temperature 的替代方案。

Response

200Anthropic Messages JSON 或 SSE 响应。

application/json · AnthropicMessageResponse

FieldTypeDescription
contentarray<AnthropicTextBlock | AnthropicToolUseBlock>响应内容块列表。
idstring消息 ID。
modelstring实际使用的模型名。
rolestring (assistant)
stop_reasonstring (end_turn | max_tokens | stop_sequence | tool_use)结束原因。
stop_sequencestring命中的停止序列。
typestring (message)
usageobject
usage.input_tokensinteger输入 token 数。
usage.output_tokensinteger输出 token 数。

defaultAnthropic 兼容错误。

application/json · AnthropicError

FieldTypeDescription
errorobject
error.messagestring
error.typestring
typestring (error)

Model list

GET/api/coding-plan/v1/models

Coding Plan 模型列表

返回 Coding Plan 可用的聚合模型名。未鉴权时返回公开模型,携带 cp_live_ Key 时 按组织模型权限过滤。

Coding Plan subscription keyUse the Authorization: Bearer cp_live_... header (subscription-only key); x-api-key is also supported.

Request structure

The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.

HTTP
GET https://www.silvamux.com/api/coding-plan/v1/models
Authorization: Bearer $SILVAMUX_CP_API_KEY

Response

200OpenAI 兼容模型列表。

application/json · ModelList

FieldTypeDescription
dataarray<object>
data.createdinteger
data.idstring可直接填入请求 model 字段的聚合模型调用名。
data.objectstring (model)
data.owned_bystring (system)
objectstring (list)

defaultOpenAI 兼容错误。

application/json · OpenAIError

FieldTypeDescription
errorobject
error.codestring | integer
error.messagestring
error.typestring

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.