Appearance
接口兼容总览
LLMGateway 的 /v1 接口面向 OpenAI-compatible 客户端。除特别说明外,请使用:
text
Base URL: https://llm.lytokens.com/v1
Authorization: Bearer sk-gtw-REPLACE_ME
Content-Type: application/json测试环境和正式环境的 Base URL 由文档站构建配置注入,不要混用。
已支持接口
| 接口 | SDK 方法 | 文档 | 说明 |
|---|---|---|---|
GET /v1/models | client.models.list() | 模型列表 | 返回当前可用模型列表 |
GET /v1/models/{model} | client.models.retrieve(model) | 模型列表 | 查询单个模型 |
GET /v1/model-catalog | HTTP API | 模型列表 | 返回模型能力、模态、任务分类 |
POST /v1/chat/completions | client.chat.completions.create() | Chat Completions | 文本/多模态对话,支持 SSE |
POST /v1/responses | client.responses.create() | Responses | 新版 Responses API,支持 SSE 和取消 |
POST /v1/embeddings | client.embeddings.create() | Embeddings | 文本向量化 |
POST /v1/rerank | HTTP API | Rerank | 文档重排序,支持文本和图片 |
POST /v1/messages | Anthropic SDK | Anthropic Messages | Anthropic Messages 兼容接口 |
GET /v1/responses/{request_id} | HTTP API | Responses | 查询断流缓存结果 |
通用响应
OpenAI-compatible /v1/* 接口不包裹公司内部 {code,message,data}。成功响应保持对应协议格式;失败响应使用 OpenAI 风格 error envelope:
json
{
"error": {
"message": "upstream service temporarily unavailable",
"type": "upstream_error",
"code": "502"
}
}通用边界
| 项 | 说明 |
|---|---|
| 鉴权 | 必须传 Authorization: Bearer <API Key> |
| 模型名 | 大小写敏感,以 /v1/models 返回为准 |
| 能力判断 | 使用 /v1/model-catalog 查看 modalities、tasks、features |
| 流式 | Chat Completions 和 Responses 支持 SSE |
| 文件上传 | 暂未开放 /v1/files 文件管理能力 |
| 未启用接口 | 返回 501 unsupported_feature,见 不支持接口 |