跳转到主要内容
Translation Task Assessment Okay, here’s the breakdown of my approach to translating this LemonData API documentation into Simplified Chinese. My main focus is accuracy, clarity, and adherence to the specified guidelines. As a seasoned technical translator, I’m aiming for a professional and precise tone that reflects the technical nature of the content. First, I need to make sure I grasp the specific instructions. The core principles are clear: translate all text (headings, paragraphs, lists, and content within the <Card> component, etc.) and NOT translate code blocks, inline code snippets, URLs, API endpoints/paths, variable names, component names (like <Card>), and parameter names. I also have to maintain the MDX structure and formatting precisely, preserving markdown syntax, line breaks, and spacing as they are. Importantly, I will keep certain common technical terms in English (API, SDK, token, etc.) for consistency and ease of understanding for tech audiences. I’ll start with the Frontmatter. The title: 'API Reference' will become title: 'API 参考' and the description: 'Complete reference for the LemonData API' will be translated to description: 'LemonData API 的完整参考文档'. Next, I’ll move sequentially through each section. For example, ## Overview becomes ## 概览, and the following paragraph gets translated accordingly. When I encounter terms such as “OpenAI-compatible”, I will translate it as “兼容 OpenAI”. And “Anthropic” and “Gemini” will stay as is since they are specific company names. As I work, I’ll pay close attention to any specific formatting, for example, the <Warning> component, where I’ll translate the text within it, and keep the Markdown syntax for the lists, such as changing ”- cURL - Copy the example commands and replace `sk-your-api-key` with your actual key” to ”- cURL - 复制示例命令并将 `sk-your-api-key` 替换为您的实际密钥”. In the Supported Endpoints section, table headers like Endpoint, Method, and Description will be translated to 端点, 方法, and 描述, respectively. For the descriptions of the endpoints, for example, "OpenAI-compatible chat completions" becomes "兼容 OpenAI 的对话补全". When I encounter a term like OpenAI Responses API, I’ll consider keeping the English wording to preserve specificity; if I translate it, it might become “OpenAI 响应 API”, but it’s important to be judicious about such choices. In sections like Embeddings & Rerank, I’ll translate “Create text embeddings” to “创建文本嵌入”, and “Rerank documents” to “对文档进行重排序”. In Gemini (v1beta), I’ll keep the section header in English, but translate the supporting text. For the Routing Transparency section, table headers such as Field, and Description are also translated into 字段 and 描述. I will translate “Channel identifier used” into “使用的渠道标识符”, “Upstream provider (openai, anthropic, etc.)” to “上游提供商 (openai, anthropic 等)”, and “`PLATFORM` (LemonData) or `PRIVATE` (BYOK)” to “`PLATFORM` (LemonData) 或 `PRIVATE` (BYOK)”, as well as “Whether response was served from cache” into “响应是否来自缓存” and “Number of retry attempts (if any)” to “重试次数(如果有)”. In the Rate Limits section, table headers like Role and Requests/min get translated to 角色 and 请求数/分钟, the roles will be translated. Finally, in the OpenAPI Specification section, <Card title="OpenAPI Spec" icon="file-code" href="/openapi.json"> will be translated as <Card title="OpenAPI 规范" icon="file-code" href="/openapi.json">, and “Download the complete OpenAPI 3.0 specification” will be “下载完整的 OpenAPI 3.0 规范”. Throughout this whole process, I’ll be double-checking my work to ensure that: code blocks, inline code, URLs/Links, API endpoints, and component names are all preserved in their original English form, the MDX structure remains intact, and the overall tone is professional and accurate. The final output must be solely the translated Simplified Chinese content, adhering exactly to the original MDX structure and formatting, ready for integration into the documentation system.

title: ‘API 参考’ description: ‘LemonData API 的完整参考文档’

概览

LemonData API 兼容 OpenAI,这意味着您只需更改基础 URL 即可使用官方 OpenAI SDK。我们还支持原生的 AnthropicGemini 请求格式。

基础 URL

https://api.lemondata.cc

身份验证

所有 API 端点都需要使用 Bearer token 进行身份验证:
Authorization: Bearer sk-your-api-key
控制面板 获取您的 API 密钥。
关于交互式演练场:本文档网站上的演练场仅用于演示目的,不支持输入 API 密钥。要测试 API,请使用:
  • cURL - 复制示例命令并将 sk-your-api-key 替换为您的实际密钥
  • Postman - 导入我们的 OpenAPI 规范
  • SDK - 使用带有我们基础 URL 的 OpenAI/Anthropic SDK

支持的端点

对话与文本生成

端点方法描述
/v1/chat/completionsPOST兼容 OpenAI 的对话补全
/v1/messagesPOST兼容 Anthropic 的 messages API
/v1/responsesPOSTOpenAI Responses API

嵌入与重排序 (Rerank)

端点方法描述
/v1/embeddingsPOST创建文本嵌入
/v1/rerankPOST对文档进行重排序

图像

端点方法描述
/v1/images/generationsPOST根据文本生成图像
/v1/images/editsPOST编辑图像

音频

端点方法描述
/v1/audio/speechPOST文本转语音 (TTS)
/v1/audio/transcriptionsPOST语音转文本 (STT)

视频

端点方法描述
/v1/videos/generationsPOST创建视频生成任务
/v1/videos/generations/{id}GET获取视频任务状态

音乐

端点方法描述
/v1/music/generationsPOST创建音乐生成任务
/v1/music/generations/{id}GET获取音乐任务状态

3D 生成

端点方法描述
/v1/3d/generationsPOST创建 3D 模型生成任务
/v1/3d/generations/{id}GET获取 3D 任务状态

模型

端点方法描述
/v1/modelsGET列出所有可用模型
/v1/models/{model}GET获取特定模型信息

Gemini (v1beta)

原生 Google Gemini API 格式支持:
端点方法描述
/v1beta/models/{model}:generateContentPOST生成内容 (Gemini 格式)
/v1beta/models/{model}:streamGenerateContentPOST流式生成内容 (Gemini 格式)
除了标准的 Bearer token 外,Gemini 端点还支持 ?key= 查询参数身份验证。

响应格式

所有响应都遵循一致的格式:

成功响应

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1234567890,
  "model": "gpt-4o",
  "choices": [...],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 20,
    "total_tokens": 30
  }
}

路由透明度

所有响应都包含一个带有渠道信息的 _routing 字段:
{
  "id": "chatcmpl-abc123",
  ...,
  "_routing": {
    "channel": {
      "id": "ch_xxx",
      "name": "channel-name",
      "provider": "openai",
      "channelType": "PLATFORM"
    },
    "cached": false,
    "retryCount": 0
  }
}
字段描述
channel.id使用的渠道标识符
channel.provider上游提供商 (openai, anthropic 等)
channel.channelTypePLATFORM (LemonData) 或 PRIVATE (BYOK)
cached响应是否来自缓存
retryCount重试次数(如果有)

错误响应

{
  "error": {
    "message": "Invalid API key provided",
    "type": "invalid_api_key",
    "code": "invalid_api_key"
  }
}

速率限制

速率限制基于角色,并可由管理员配置。默认值:
角色请求数/分钟
用户60
合作伙伴300
VIP1,000
如需自定义速率限制,请联系支持团队。确切数值可能因账户配置而异。
当超过速率限制时,API 会返回 429 状态码,并带有 Retry-After 响应头,指示需要等待多长时间。

OpenAPI 规范

OpenAPI 规范

下载完整的 OpenAPI 3.0 规范