API Reference

Endpoint 详细

当前已上线 endpoints:POST /chat/completions 与 GET /models。Embeddings、TTS、voice-clone 在路线图中,上线后此页会更新。

基础信息

  • Base URL: https://solquir.io/api/v1
  • Auth: Authorization: Bearer <api-key>
  • Content-Type: application/json(除 multipart upload)
  • 响应格式: JSON,错误用 {"error": {"type": "...", "message": "..."}}
  • 追溯 ID: 每个响应带 X-Solquir-Trace-Id header

POST /chat/completions

OpenAI 兼容 chat completions endpoint。支持 streaming 与 non-streaming。

请求 body

字段类型必填说明
modelstring模型 apiSlug,如 solquir-v1
messagesarrayOpenAI message 格式
streambooleantrue = SSE 流
temperaturenumber0-2,默认 0.7
max_tokensinteger上限 32k
top_pnumbernucleus sampling,默认 1

响应(非流式)

json
{
  "id": "chatcmpl-0xK2w...",
  "object": "chat.completion",
  "created": 1778550172,
  "model": "solquir-v1",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 222,
    "completion_tokens": 31,
    "total_tokens": 253,
    "cost_micro_usd": 4280
  },
  "thinking": [
    { "stage": "route", "picked": "claude-opus", "reason": "..." },
    { "stage": "tool", "name": "search", "ms": 480 }
  ]
}
NOTEthinking 字段是 Solquir 独有的扩展(OpenAI 没有), 不影响 OpenAI SDK 解析。

GET /models

返回全部上架、active 的模型目录(不需要 API key)。OpenAI SDK 可用 client.models.list() 调用,或直接 GET 请求。

响应

json
{
  "object": "list",
  "data": [
    {
      "id": "solquir-v1",
      "object": "model",
      "owned_by": "solquir",
      "displayName": "Solquir V1",
      "description": "通用对话旗舰模型",
      "kind": "chat",
      "saleInputMicroUsdPerToken": 2,
      "saleOutputMicroUsdPerToken": 8,
      "currency": "USD",
      "modality": "text",
      "isActive": true,
      "created": 1778550172
    }
  ]
}
NOTEsaleInputMicroUsdPerToken saleOutputMicroUsdPerToken 单位是 microUSD(百万分之一美元)。 实际费用 = tokens × 对应值。OpenAI SDK 不感知这些扩展字段,正常忽略。

GET /storefront/* (公开)

不需 API key。给前端站点 / 第三方 marketplace 拉商品目录用。

  • GET /storefront/categories — 全部 active 分类
  • GET /storefront/listings?category=<slug> — 列表
  • GET /storefront/listings/:slug — 单个详情