LLM 调用
ModelPlane 的大部分配置都在 https://app.modelplane.dev 的 UI 中完成。开发者只需要 LLM base URL、应用 API key,以及产品或平台团队选定的 model group 名称。
基础 Chat 调用
bash
curl https://api.modelplane.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "coding-agent",
"messages": [
{ "role": "user", "content": "Review this function and suggest tests." }
]
}'使用 Model Group
model 值来自控制台里的 model group 名称。路由、Provider 选择、fallback、quota 处理和计费归因都由 ModelPlane 处理。
json
{
"model": "smart-llm",
"messages": [
{ "role": "user", "content": "Summarize this incident report." }
]
}请求 Reasoning
对支持 reasoning 的模型和路由,调用方可以请求 thinking budget:
json
{
"model": "reasoning",
"messages": [
{ "role": "user", "content": "Find the likely root cause." }
],
"reasoning": {
"enabled": true,
"effort": "medium",
"max_tokens": 2048
}
}查询可用 Model
GET /v1/models 会返回你的 gateway API key 所在 workspace 可以调用的 model group —— 采用 OpenAI 兼容的模型列表约定,但数据来自你自己的 model group,而不是固定的 provider 目录。
bash
curl https://api.modelplane.dev/v1/models \
-H "Authorization: Bearer YOUR_GATEWAY_API_KEY"json
{
"object": "list",
"data": [
{ "id": "smart-llm", "object": "model", "created": 1755000000, "owned_by": "modelplane" },
{ "id": "coding-agent", "object": "model", "created": 1755043200, "owned_by": "modelplane" }
]
}每个 id 就是一个 model group 名称 —— 在 chat completion 请求中作为 model 传入即可。列表只包含你的 API key 所在 workspace 下处于 active 状态的 model group。
Embedding Model Group
加上 ?output_modalities=embeddings 可以改为列出 /v1/embeddings 请求所路由的 embedding model group(参见 Embedding Model Group):
bash
curl "https://api.modelplane.dev/v1/models?output_modalities=embeddings" \
-H "Authorization: Bearer YOUR_GATEWAY_API_KEY"json
{
"object": "list",
"data": [
{
"id": "text-embed",
"object": "model",
"created": 1755000000,
"owned_by": "modelplane",
"dimensions": 1536
}
]
}返回格式
最终答案在 message.content。如果所选 Provider 和模型返回 reasoning,则会单独出现在 reasoning 字段中。
json
{
"choices": [
{
"message": {
"role": "assistant",
"content": "最可能原因是数据库连接池耗尽。",
"reasoning": "延迟峰值与连接等待一致,而不是 CPU 饱和。"
}
}
]
}开发者不需要处理什么
- Provider API keys。
- Backend IDs。
- Routing trees。
- Plan quota thresholds。
- Fallback policies。
- Billing aggregation。
这些都在 ModelPlane 控制台中管理。

