API 文档
MyTokenGate API 完整参考。
OpenAI 兼容 API
对话补全
对话式 AI 交互的主要 API。支持流式输出、函数调用和视觉能力。
Anthropic 兼容 API
消息接口
Claude 原生 API,支持高级推理和工具调用。支持思考模式和扩展上下文。
平台 API
模型列表
获取可用模型及其能力。
快速开始
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://gateway.mytokengate.com/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "你好!"}]
)
print(response.choices[0].message.content)Base URL
https://gateway.mytokengate.com/v1认证
所有 API 请求需要在 Authorization 头中包含 Bearer token:
Authorization: Bearer YOUR_API_KEYLast updated on