开发者Developers
5 分钟接入 Elysia APIIntegrate Elysia API in 5 minutes
Elysia API 兼容 OpenAI 协议。把 base_url 换成下面的地址,使用控制台创建的令牌即可。Elysia API speaks the OpenAI protocol. Use the base URL below with a token from the console.
获取账号Get an account
自助注册已关闭。购买包含 API 的 Flow 套餐,或联系我们开通。Self-registration is closed. Buy the Flow plan (includes the API) or contact us.
创建令牌Create a token
登录 控制台 → 令牌 → 新建,可设置额度、有效期与可用模型。Sign in to the console → Tokens → New. Set quota, expiry and allowed models.
发起请求Make a request
使用右侧示例,把 model 换成模型页中的任意 ID。Use the samples, setting model to any ID from the Models page.
查看用量Track usage
控制台「日志」按请求显示模型、Token 与费用,可导出。Console → Logs shows model, tokens and cost per request, exportable.
curl https://api.elysia.ltd/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ELYSIA_API_KEY" \
-d '{
"model": "gpt-6-sol",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}'# pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://api.elysia.ltd/v1",
api_key="sk-...", # 在控制台「令牌」页创建 / create in Console → Tokens
)
resp = client.chat.completions.create(
model="gpt-6-sol",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)// npm i openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.elysia.ltd/v1",
apiKey: process.env.ELYSIA_API_KEY,
});
const resp = await client.chat.completions.create({
model: "gpt-6-sol",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);# 任何兼容 OpenAI 的工具 / any OpenAI-compatible tool
OPENAI_BASE_URL=https://api.elysia.ltd/v1
OPENAI_API_KEY=sk-...接口Endpoints
| 方法Method | 路径Path | 说明Description |
|---|---|---|
POST | /v1/chat/completions | 对话补全(支持 stream: true)Chat completions (supports stream: true) |
POST | /v1/images/generations | 图像生成(部分模型)Image generation (selected models) |
GET | /v1/models | 列出当前令牌可用模型(需鉴权)List models available to your token (auth required) |
鉴权头:Authorization: Bearer <你的令牌>。未携带有效令牌时 /v1/* 返回 401。Auth header: Authorization: Bearer <your token>. /v1/* returns 401 without a valid token.
在客户端中使用Use it in your favourite client
在客户端的「OpenAI 兼容 / 自定义提供商」中填写:In the client’s “OpenAI-compatible / custom provider” settings, enter:
API Base URL
https://api.elysia.ltd/v1
部分客户端只填 https://api.elysia.ltd,会自动补 /v1Some clients want https://api.elysia.ltd and append /v1 themselves
API Key
sk-…
控制台 → 令牌 中创建并复制Create and copy from Console → Tokens
安全提示:API 令牌等同密码,请保存在服务端环境变量中,不要写进前端代码或公开仓库。我们不会通过邮件索要令牌。Security: treat tokens like passwords. Keep them in server-side environment variables, never in browser code or public repos. We never ask for tokens by email.