本服务提供 OpenAI 兼容的 API 接口,标准 OpenAI SDK / 客户端可直接接入。
| API 地址(Base URL) | https://trelayai.com/v1(部署后以实际为准) |
|---|---|
| 认证方式 | 请求头 x-api-key: tp_xxxxxxxx或 Authorization: Bearer tp_xxxxxxxx(OpenAI SDK 默认方式) |
| 支持功能 | Chat Completions(普通 + 流式 stream)、模型列表、余额查询 |
from openai import OpenAI
client = OpenAI(
api_key="tp_xxxxxxxx", # 你的 API Key
base_url="https://trelayai.com/v1", # 本站地址
)
response = client.chat.completions.create(
model="模型名", # 用 /v1/models 查询可用模型
messages=[{"role": "user", "content": "Hello!"}],
stream=True, # 支持流式输出
)
for chunk in response:
print(chunk.choices[0].delta.content or "", end="")
curl https://trelayai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer tp_xxxxxxxx" \
-d '{"model":"模型名","messages":[{"role":"user","content":"Hello"}]}'
| 接口 | 方法 | 说明 |
|---|---|---|
| /v1/chat/completions | POST | 对话补全(支持 stream) |
| /v1/models | GET | 可用模型列表 |
| /customer/balance | GET | 查询余额 |
curl https://trelayai.com/customer/balance -H "x-api-key: tp_xxxxxxxx"
购买充值码:请发送邮件至 punamdew297@gmail.com,注明金额,支持 USDT / 微信 / 支付宝。付款后你会收到充值码,在充值页面输入 API Key 和充值码,余额即时到账,7×24 小时自助完成。
前往充值 →· 请妥善保管 API Key,泄露请立即联系管理员重置
· 余额不足时 API 会返回 402 错误
· 计费按上游返回的实际 token 用量计算,精确到 micro-USD
· 接口兼容 OpenAI 格式,任何支持自定义 Base URL 的客户端软件均可使用
OpenAI-compatible API. Standard OpenAI SDKs and clients work out of the box.
| Base URL | https://trelayai.com/v1 (final URL after deployment) |
|---|---|
| Authentication | Header x-api-key: tp_xxxxxxxxor Authorization: Bearer tp_xxxxxxxx (default for OpenAI SDK) |
| Features | Chat Completions (non-stream + stream), model listing, balance query |
from openai import OpenAI
client = OpenAI(
api_key="tp_xxxxxxxx", # your API key
base_url="https://trelayai.com/v1", # this service
)
response = client.chat.completions.create(
model="model-name", # list via /v1/models
messages=[{"role": "user", "content": "Hello!"}],
stream=True, # streaming supported
)
for chunk in response:
print(chunk.choices[0].delta.content or "", end="")
curl https://trelayai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer tp_xxxxxxxx" \
-d '{"model":"model-name","messages":[{"role":"user","content":"Hello"}]}'
| Endpoint | Method | Description |
|---|---|---|
| /v1/chat/completions | POST | Chat completions (stream supported) |
| /v1/models | GET | List available models |
| /customer/balance | GET | Query your balance |
curl https://trelayai.com/customer/balance -H "x-api-key: tp_xxxxxxxx"
To purchase a recharge code, email punamdew297@gmail.com with your desired amount. We accept USDT, WeChat Pay, and Alipay. After payment you will receive a code; redeem it on the redeem page and your balance is credited instantly.
Redeem a code →· Keep your API key safe; contact the admin immediately if leaked
· HTTP 402 is returned when balance is insufficient
· Billing is based on actual token usage reported by upstream, in micro-USD precision
· Fully OpenAI-compatible: any client supporting a custom Base URL works