API 参考
OpenAI 扩展端点
OpenAI 兼容聊天之外的扩展端点地图,包括 embeddings、图像、音频、文件、批处理、Assistants、Threads 和视频。
这些路由使用 OpenAI 兼容前缀,但不是推荐的第一条集成路径。当你的客户端已经依赖这些 OpenAI API 形态,或工作流明确需要它们时再使用。
状态
Pass-through。请求和响应通常跟随所选模型或提供方的 OpenAI/LiteLLM 兼容行为。生产前请针对目标模型逐条验证。
Base URL 与认证
https://api.anyint.ai/openai/v1
Authorization: Bearer <ANYINT_API_KEY>
Content-Type: application/json路由
| 路由 | 常见用途 |
|---|---|
POST /embeddings | 生成向量 embedding |
POST /images/generations | 生成图像;Kling 模型 ID 可通过 Transtreams 适配 |
POST /audio/speech | 文本转语音 |
POST /audio/transcriptions | 语音转文本 |
POST /audio/translations | 音频翻译 |
POST /moderations | 内容审核 |
/files, /files/{file_id}, /files/{file_id}/content | OpenAI 兼容文件操作 |
/assistants, /assistants/{assistant_id} | 上游启用时的 Assistants API 透传 |
/threads, /threads/{thread_id}, /threads/{thread_id}/messages, /threads/{thread_id}/runs | 上游启用时的 Threads 和 Runs 透传 |
/batches, /batches/{batch_id}, /batches/{batch_id}/cancel | 上游启用时的批处理任务透传 |
/videos, /videos/{video_id}, /videos/{video_id}/content | OpenAI 风格视频生成和查询 |
Embeddings 示例
Embeddings 请求字段
| 字段 | 类型 | 必填 | 含义 | 示例 |
|---|---|---|---|---|
model | 字符串 | 是 | 当前账号可用的 embedding 模型 ID。 | text-embedding-v4 |
input | 字符串或数组 | 是 | 要生成 embedding 的文本或文本列表。 | AnyInt routes one application... |
encoding_format | 字符串 | 否 | 支持时的向量编码格式。 | float |
dimensions | 整数 | 否 | 模型支持时请求的向量维度。 | 1024 |
user | 字符串 | 否 | 客户侧终端用户标识,用于追踪或滥用监控。 | user_123 |
curl https://api.anyint.ai/openai/v1/embeddings \
-H "Authorization: Bearer $ANYINT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-v4",
"input": "AnyInt routes one application through multiple model families."
}'Embeddings 响应字段
| 字段 | 含义 |
|---|---|
data[].embedding | Embedding 向量 |
data[].index | 批量请求中的输入序号 |
model | 用于 embedding 的模型 |
usage.prompt_tokens | 返回时的输入 token 数 |
usage.total_tokens | 返回时的总 token 数 |
图像生成示例
图像生成请求字段
| 字段 | 类型 | 必填 | 含义 | 示例 |
|---|---|---|---|---|
model | 字符串 | 是 | 图像模型 ID。如需完整提供方原生控制,请使用 媒体 API。 | kling-v3-omni |
prompt | 字符串 | 是 | 描述目标图像的文本提示词。 | A cinematic product poster... |
size | 字符串 | 否 | 所选路径支持时的输出尺寸。 | 1024x1024 |
n | 整数 | 否 | 支持时请求的图像数量。 | 1 |
response_format | 字符串 | 否 | 支持时的响应格式。 | url |
user | 字符串 | 否 | 客户侧终端用户标识。 | user_123 |
curl https://api.anyint.ai/openai/v1/images/generations \
-H "Authorization: Bearer $ANYINT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-omni",
"prompt": "A cinematic product poster for an AI music launch."
}'更完整的提供方原生图像示例请看 图像生成 和 媒体 API。
音频请求字段
| 路由 | 重要字段 | 说明 |
|---|---|---|
POST /audio/speech | model, input, voice, response_format, speed | 文本转语音。支持的声音和格式取决于所选模型。 |
POST /audio/transcriptions | file, model, language, prompt, response_format, temperature | 客户端要求时使用 multipart 上传。 |
POST /audio/translations | file, model, prompt, response_format, temperature | 将音频翻译为英文或提供方支持的目标行为。 |
文件、Assistant、Thread 和 Batch 字段
这些端点是透传兼容路由。仅当你的客户端已经依赖 OpenAI 兼容结构时使用,并针对所选模型路径验证支持情况。
| 领域 | 常见字段 | 客户指导 |
|---|---|---|
| Files | file, purpose, file_id | 仅在客户端需要 OpenAI 兼容 file 对象时使用。 |
| Assistants | model, name, instructions, tools, file_ids | 新的简单应用优先使用 Chat Completions 或 Responses,除非客户端要求 Assistants。 |
| Threads | messages, metadata, thread_id | 适用于内置 thread 处理的 OpenAI 兼容客户端。 |
| Runs | assistant_id, model, instructions, tools, stream | 按模型验证工具和流式行为。 |
| Batches | input_file_id, endpoint, completion_window, metadata | 适用于已经生成兼容 batch 文件的客户端。 |
视频路由行为
OpenAI 风格视频请求可以发送到 /openai/v1/videos。使用 model 字段选择当前账号可用的视频模型 ID。可用模型 ID 通过 模型 API 查询;可选参数请查看对应模型专页。
Kling 专属示例见 Kling 视频。如果你的集成需要 model_name、image_list、video_list 等提供方原生字段,请使用对应模型专页中的提供方原生路由。
常见错误
- 假设所有 OpenAI 上游功能都对每个 AnyInt 模型启用
- 未查看路由页面,就把提供方原生媒体 payload 发送到 OpenAI 兼容端点
- 新应用在 Chat Completions 或 Responses 足够时,过早使用 Assistants、Threads、Batches 或 Files