几分钟内将您的应用接入 e-Gate AI 网关 — 只需更换 base URL 和 API 密钥。
e-Gate AI 网关是兼容 OpenAI 的 API。通过单个 base URL 调用所有模型。API 密钥内嵌了 serving 服务器(machineId)— 网关会自动把请求路由到正确的服务器:
sk-61d35a1d80f1d3dd-... — 服务器 1sk-9357e1fe59b66398-... — 服务器 2在控制台创建密钥即可,网关处理其余一切 — 无需额外配置。
登录控制台 → API 密钥 → 选择服务器、命名、设置预算 → 创建。完整密钥(sk-<machineId>-…)仅显示一次 — 请立即复制保存。
每个请求都必须在 Authorization 头中携带 Bearer token:
Authorization: Bearer sk-61d35a1d80f1d3dd-YOUR-KEY所有请求都发往同一个接口。丢掉以前各家供应商的 base URL 吧。
https://agent.e-gate.vn/v1把 YOUR-KEY 换成您的密钥。可用模型包括:gpt-4o、claude-3-5-sonnet、gemini-2.0-flash、deepseek-chat — 完整列表见价格页面。
curl https://agent.e-gate.vn/v1/chat/completions \
-H "Authorization: Bearer sk-61d35a1d80f1d3dd-YOUR-KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{ "role": "user", "content": "Hello!" }]
}'e-Gate 与官方 OpenAI SDK 完全兼容 — 只需把 base_url 指向 e-Gate 并更换 api_key:
from openai import OpenAI
client = OpenAI(
base_url="https://agent.e-gate.vn/v1",
api_key="sk-61d35a1d80f1d3dd-YOUR-KEY",
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)流式输出(SSE):
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://agent.e-gate.vn/v1',
apiKey: 'sk-61d35a1d80f1d3dd-YOUR-KEY',
});
const resp = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(resp.choices[0].message.content);用您的 base URL 和 API 密钥配置常用工具。
# Cursor → Settings → Models → Add custom model
Name: gateway
Base URL: https://agent.e-gate.vn/v1
API Key: sk-61d35a1d80f1d3dd-YOUR-KEY
Model ID: gpt-4o (or any model from /v1/models)图片同步生成;视频异步生成(创建任务 → 轮询状态 → 下载文件)。视频按秒计费——在 Prices 页查看每秒单价。
# Image generation
curl https://agent.e-gate.vn/v1/images/generations \
-H "Authorization: Bearer sk-61d35a1d80f1d3dd-YOUR-KEY" \
-H "Content-Type: application/json" \
-d '{"model":"dall-e-3","prompt":"a cat","n":1,"size":"1024x1024"}'
# Video generation (async: create → poll → download)
curl https://agent.e-gate.vn/v1/videos/generations \
-H "Authorization: Bearer sk-61d35a1d80f1d3dd-YOUR-KEY" \
-H "Content-Type: application/json" \
-d '{"model":"videopr/wan3.0","prompt":"a cat walking","seconds":"5","size":"1280x720"}'
# → {"id":"task_...","status":"queued"} — poll until completed.
# Use the id exactly as returned (it may look like "task_x:provider").
# If the server says "Query parameter 'model' is required", add ?model=<model>:
curl https://agent.e-gate.vn/v1/videos/task_... \
-H "Authorization: Bearer sk-61d35a1d80f1d3dd-YOUR-KEY"
# → {"status":"completed","video_url":"https://...mp4"} — download the file返回二进制音频(非 JSON)——请保存为对应格式后缀的文件。输入最多 4096 字符。
# Text-to-speech (returns binary audio, not JSON)
curl https://agent.e-gate.vn/v1/audio/speech \
-H "Authorization: Bearer sk-61d35a1d80f1d3dd-YOUR-KEY" \
-H "Content-Type: application/json" \
-d '{"model":"tts-1","input":"Hello world","voice":"alloy","response_format":"mp3"}' \
--output hello.mp3您可能遇到的错误码:
需要帮助?通过 Messenger(Messenger [email protected] 联系我们。