eelapi logo电鳗 eelapi
登录

接入代码 / 文档

通过统一 Base URL 和 API Key 接入 AI 模型

公开接入说明帮助团队评估技术路径。登录控制台后可以创建 API Key、查看模型列表、进行接口调试并跟踪用量记录。

接入代码 / 文档

eelapi API 文档

拿到 API Key 后,你可以通过统一 Base URL 调用已接入模型。当前接口采用 OpenAI 风格的 Chat Completions 请求与返回格式。

Base URL

https://eelapi.com/api/v1

认证 Header

Authorization: Bearer YOUR_EELAPI_KEY

推荐验证模型

deepseek-chat

快速开始

  1. 1登录 eelapi 控制台并创建 API Key。
  2. 2在模型列表确认要调用的模型已接入并启用。
  3. 3使用 POST /api/v1/chat/completions 发起请求。
  4. 4在用量记录里核对 token、费用和请求状态。

获取 API Key

进入控制台的 API Key 页面创建密钥。完整 API Key 只在创建后用于复制,列表里只显示 key prefix,避免长期明文暴露。

Base URL

线上生产

https://eelapi.com/api/v1

聊天接口地址

https://eelapi.com/api/v1/chat/completions

认证方式

外部 API 调用必须在请求头中加入 Authorization Bearer。当前外部接口不使用 x-api-key,请不要复制成错误 header。

HTTP Header
Authorization: Bearer YOUR_EELAPI_KEY

聊天接口

当前公开接口为 POST /api/v1/chat/completions。请求体采用 OpenAI 风格,至少需要 model 和 messages。

Request
POST https://eelapi.com/api/v1/chat/completions
Content-Type: application/json
Authorization: Bearer YOUR_EELAPI_KEY

{
  "model": "deepseek-chat",
  "messages": [
    {
      "role": "user",
      "content": "你好,介绍一下 eelapi"
    }
  ]
}

请求参数说明

NameTypeDescription
modelstring平台模型名,必须是已接入并启用的模型,例如 deepseek-chat。
messagesarray对话消息数组,每项包含 role 与 content。
temperaturenumber可选;供应商支持时透传。
max_tokensnumber可选;限制输出 token 数。

返回格式说明

成功返回包含 choices 和 usage。usage 中的 prompt_tokens、completion_tokens、total_tokens 会用于用量记录与费用计算。

JSON response
{
  "id": "chatcmpl_xxx",
  "object": "chat.completion",
  "model": "deepseek-chat",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "你好,这里是 eelapi..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 30,
    "total_tokens": 40
  }
}

调用示例

curl
curl https://eelapi.com/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_EELAPI_KEY" \
  -d '{
    "model": "deepseek-chat",
    "messages": [
      {
        "role": "user",
        "content": "你好,介绍一下 eelapi"
      }
    ]
  }'
JavaScript fetch
const response = await fetch("https://eelapi.com/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_EELAPI_KEY"
  },
  body: JSON.stringify({
    model: "deepseek-chat",
    messages: [
      {
        role: "user",
        content: "你好,介绍一下 eelapi"
      }
    ]
  })
});

const data = await response.json();
console.log(data);
Python requests
import requests

url = "https://eelapi.com/api/v1/chat/completions"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_EELAPI_KEY"
}

data = {
    "model": "deepseek-chat",
    "messages": [
        {
            "role": "user",
            "content": "你好,介绍一下 eelapi"
        }
    ]
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

模型列表说明

  • 用户可以在模型列表查看可用模型。
  • 已接入并启用的模型才可以真实调用。
  • 未接入/目录模型仅供展示。
  • 调用未接入模型会返回友好错误。
  • 建议先使用 deepseek-chat 验证连通性。

计费说明

  • 每次成功调用后,根据模型价格和 token 用量扣费。
  • 失败请求不扣费。
  • 余额不足时请求会被拒绝。
  • 用户可以在用量记录查看每次调用费用。
  • 用户可以在充值记录查看充值历史。

OpenAI 兼容说明

eelapi 尽量兼容 OpenAI Chat Completions 格式。你可以将 OpenAI SDK 的 baseURL 改成 eelapi 的接口地址,并使用 eelapi API Key。

当前接口采用 OpenAI 风格格式,SDK 兼容性将持续完善;如遇 SDK 细节差异,请以 curl 和 fetch 示例为准。

OpenAI SDK style
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_EELAPI_KEY",
  baseURL: "https://eelapi.com/api/v1"
});

const completion = await client.chat.completions.create({
  model: "deepseek-chat",
  messages: [
    { role: "user", content: "你好" }
  ]
});

console.log(completion.choices[0].message.content);

错误码说明

HTTPMeaningWhen it happens
400Bad RequestJSON 无效、stream 暂不支持、模型停用/未接入,或未配置供应商线路。
401UnauthorizedAPI Key 缺失或无效。
402Insufficient Balance账户余额不足。
429Rate Limited请求过于频繁。
500/502/504Internal / Provider Error服务端错误、供应商线路错误或上游超时。

安全提醒

  • 不要在前端浏览器中暴露完整 API Key。
  • 不要把 API Key 上传到 GitHub。
  • 如发现泄露,请立即删除并重新创建 API Key。
  • eelapi 只显示 key prefix,不在列表展示完整密钥。

常见问题

推荐先调用哪个模型?

建议先使用 deepseek-chat 验证连通性。

未接入模型能调用吗?

不能。需要管理员在模型管理中配置供应商线路。

失败请求会扣费吗?

不会。只有成功请求才会按 token 用量扣费。