多模态理解大模型-30B (算法编码:8005400044)
协议类型:HTTPS
一、接入点
| 环境 |
地址 |
| 公网 |
https://api-maas.teleai.com.cn/aipaas/mllm/v1/telemm30b/completions |
- API Path:
/aipaas/mllm/v1/telemm30b/completions
- 请求方法:
POST
- Content-Type:
application/json
二、鉴权
采用请求头携带鉴权信息:
2.1 标准鉴权
Authorization: <鉴权信息>
| 请求头 |
必填 |
说明 |
Content-Type |
否 |
内容类型,固定 application/json |
X-APP-ID |
否 |
取值为控制台 → 应用及API Key → 创建应用 → AppID |
Device-Uuid |
否 |
设备管理 - 设备 uuid |
Authorization |
是 |
鉴权信息 |
2.2 Bearer Token 鉴权
Authorization: Bearer <用户申请的API-KEY>
| 请求头 |
必填 |
说明 |
Content-Type |
否 |
内容类型,固定 application/json |
Device-Uuid |
否 |
设备管理 - 设备 uuid |
Authorization |
是 |
Bearer <API_KEY> |
三、能力简介
多模态理解与对话。支持纯文本对话、图文多模态理解、多轮对话与工具调用(Function Calling),支持流式与非流式返回。
- 请求协议:
https
- 响应格式:统一采用 JSON 格式;
stream 为 true 时按 SSE(text/event-stream)逐块返回
3.1 修订历史
| 修订日期 |
算法版本号 |
修订内容 |
| 2026-10-22 |
V2.1.0 |
调整输入图片分辨率和最大请求体限制,增加支持图片 url,添加代理功能 |
| 2026-10-21 |
V2.0.0 |
与 V1.0.0 保持一致 |
| 2026-09-08 |
V1.0.0 |
适配 telemm 30b |
四、请求与响应
4.1 请求参数
请求报文为 JSON Object,字段按层级拆分说明如下。
4.1.1 顶层字段
| 字段 |
类型 |
必填 |
说明 |
traceId |
string |
否 |
接口跟踪 ID,每次调用需不同,可使用 UUID,用于日志排查与链路跟踪,长度小于 128 位 |
timestamp |
long |
否 |
当前时间戳(秒),示例 1749468686 |
model |
string |
否 |
要使用的模型 ID,可不填;若填写必须为 TeleAI/TeleMM |
messages |
array |
是 |
对话内容,多轮对话时须严格按照 user → assistant → user 的顺序传参,字段见 4.1.2 |
stream |
boolean |
否 |
是否流式返回,默认 false;为 true 时按 SSE 增量返回 |
stream_options |
object |
否 |
流式响应选项,仅在 stream 为 true 时设置,字段见 4.1.3 |
max_completion_tokens |
int |
否 |
最大生成词元数量,取值范围 (0, 6144];输入与生成词元总长受模型上下文长度限制;与 max_tokens 同时填写时以本字段为准 |
max_tokens |
int |
否 |
最大生成词元数量,取值范围 (0, 6144];语义同 max_completion_tokens,两者都填时以 max_completion_tokens 为准 |
temperature |
double |
否 |
采样温度,建议范围 0 到 1,取值 [0, 2];值越大输出越随机,越小越集中确定 |
top_p |
double |
否 |
核采样阈值,取值范围 (0, 1] |
n |
int |
否 |
每条输入消息生成的补全数量,取值范围 [1, 5];temperature 为 0.0 时必须为 1;将按所有选项生成的词元数计费 |
top_k |
int |
否 |
随机候选数,取值范围 [1, 120000],建议保持默认 1000 |
frequency_penalty |
double |
否 |
频率惩罚,取值 [-2.0, 2.0];正值按新生成词在已有文本中的频率降权,降低重复 |
presence_penalty |
double |
否 |
存在惩罚,取值 [-2.0, 2.0],默认 0;正值增加模型谈论新主题的可能性 |
repetition_penalty |
double |
否 |
重复惩罚,取值 (0, 2],默认 1.01,1.0 表示不惩罚;非 OpenAI 标准参数,Python SDK 调用时需放入 extra_body |
seed |
int |
否 |
随机数种子 |
stop |
string / array |
否 |
停止词,支持单个字符串或字符串数组 |
logprobs |
boolean |
否 |
是否返回输出 token 的对数概率 |
top_logprobs |
int |
否 |
每步返回模型最大概率候选 token 个数,建议 [0, 5],仅 logprobs 为 true 时生效 |
response_format |
object |
否 |
返回内容的格式,字段见 4.1.4 |
chat_template_kwargs |
object |
否 |
聊天模板参数,字段见 4.1.5 |
tools |
array |
否 |
工具列表,供模型在 Function Calling 中调用,字段见 4.1.6 |
tool_choice |
string / object |
否 |
工具选择策略:auto 模型自主选择;none 不进行工具调用;也可指定强制调用某工具 {"type":"function","function":{"name":"函数名"}}。配置 tools 后建议同时设置本参数,否则结果可能不被解析 |
parallel_tool_calls |
boolean |
否 |
是否开启并行工具调用,默认 false |
thinking_budget |
int |
否 |
未生效,预留字段 |
4.1.2 messages 对话消息
| 字段 |
类型 |
必填 |
说明 |
role |
string |
是 |
角色:system 系统消息、user 用户消息、assistant 助手消息 |
content |
string / array |
是 |
消息内容。纯文本可直接传字符串;需要传图片时传数组,格式为 [{"type":"text","text":"..."}] 或 [{"type":"image_url","image_url":{"url":"..."}}] |
content[].type |
string |
否 |
content 为数组时必填:text 文本、image_url 图片 |
content[].text |
string |
否 |
type 为 text 时必填 |
content[].image_url |
object |
否 |
type 为 image_url 时必填,格式为 {"url":"..."};图片限制见 4.1.7 |
content[].image_url.url |
string |
否 |
图片数据,支持 base64(需以 data:image 开头)或公网 http(s) url;url 方式仅支持公网可访问地址 |
4.1.3 stream_options 流式选项
| 字段 |
类型 |
必填 |
说明 |
include_usage |
boolean |
否 |
是否包含统计信息。为 true 时,在 data: [DONE] 之前的一块返回整个请求的 token 使用统计 |
4.1.4 response_format 返回内容格式
| 字段 |
类型 |
必填 |
说明 |
type |
string |
否 |
text 输出文字回复;json_object 输出标准格式 JSON 字符串;json_schema 输出指定格式 JSON 字符串 |
json_schema |
object |
否 |
type 为 json_schema 时必填 |
json_schema.name |
string |
否 |
Schema 唯一标识名称,仅支持字母(不区分大小写)、数字、下划线和短横线;type 为 json_schema 时必填 |
json_schema.description |
string |
否 |
描述 Schema 的用途 |
json_schema.schema |
object |
否 |
定义模型输出的数据结构;type 为 json_schema 时必填 |
4.1.5 chat_template_kwargs 聊天模板参数
| 字段 |
类型 |
必填 |
说明 |
enable_thinking |
boolean |
否 |
是否开启思考模式,不填默认开启 |
4.1.6 tools 工具定义
| 字段 |
类型 |
必填 |
说明 |
type |
string |
否 |
工具类型,当前仅支持 function |
function |
object |
否 |
定义一个可被模型调用的函数(工具) |
function.name |
string |
否 |
工具名称,仅支持字母(不区分大小写)、数字、下划线和短横线 |
function.description |
string |
否 |
函数用途、适用场景及参数语义说明,供模型自动选择与调用工具时参考 |
function.parameters |
object |
否 |
函数参数结构(JSON Schema),模型据此生成调用参数 |
4.1.7 图片输入限制
| 项目 |
限制说明 |
| 单图大小 |
base64 与 url 两种方式,单图均不超过 40M |
| 图片分辨率 |
短边大于 28,且 h*w < 4096*2160(V2.1.0 口径;V1.0.0 为大于 20*20、小于 8192*8192) |
| 单上下文图片数量 |
单个上下文窗口合计不超过 50 张,具体可传数量受模型上下文窗口限制 |
4.2 响应体
- 返回结果:成功 (200),JSON Object;
stream 为 true 时以 SSE 流式返回
- 响应结果说明:非流式一次性返回完整结果;流式按增量分块返回,开启思考模式时先返回
reasoning、reasoning_content 内容,再返回 content 正式结果
4.2.1 流式返回字段
| 字段 |
类型 |
必填 |
说明 |
id |
string |
是 |
聊天补全的唯一标识符(uuid4) |
object |
string |
是 |
对象类型,流式返回为 chat.completion.chunk |
created |
long |
是 |
时间戳 |
model |
string |
是 |
用于生成补全的模型 |
choices |
array |
否 |
聊天补全选项的列表 |
choices[].index |
int |
否 |
选项在列表中的索引 |
choices[].delta |
object |
否 |
本次增量内容 |
choices[].delta.role |
string |
否 |
消息作者角色,首块通常为 assistant |
choices[].delta.content |
string |
否 |
增量文本内容 |
choices[].delta.reasoning |
string |
否 |
思考过程内容,开启思考模式时先于 content 返回 |
choices[].delta.reasoning_content |
string |
否 |
思考过程内容,与 reasoning 同义 |
choices[].delta.tool_calls |
array |
否 |
模型生成的工具调用 |
choices[].delta.refusal |
string |
否 |
未生效,预留字段 |
choices[].finish_reason |
string |
否 |
停止原因:stop 自然停止或命中停止序列;length 达到最大词元数;content_filter 内容被过滤;tool_calls 调用了工具;function_call 调用了函数(已弃用) |
choices[].stop_reason |
string |
否 |
模型内部的停止原因 |
choices[].logprobs |
object |
否 |
输出 token 的对数概率,未开启时为 null |
usage |
object |
否 |
token 统计。仅 stream_options.include_usage 为 true 时,最后一块携带,其余块为 null;未开启时整体不返回 |
usage.completion_tokens |
int |
否 |
生成的 token 数 |
usage.prompt_tokens |
int |
否 |
prompt 的 token 数 |
usage.total_tokens |
int |
否 |
总 token 数 |
usage.completion_tokens_details |
object |
否 |
未生效,预留字段 |
4.2.2 非流式返回字段
| 字段 |
类型 |
必填 |
说明 |
id |
string |
是 |
聊天补全的唯一标识符(uuid4) |
object |
string |
是 |
对象类型,固定 chat.completion |
created |
long |
是 |
时间戳 |
model |
string |
是 |
用于生成补全的模型,如 TeleAI/TeleMM |
choices |
array |
否 |
聊天补全选项的列表 |
choices[].index |
int |
否 |
选项在列表中的索引 |
choices[].message |
object |
否 |
模型生成的聊天补全消息 |
choices[].message.role |
string |
否 |
消息作者角色,通常为 assistant |
choices[].message.content |
string |
否 |
消息内容 |
choices[].message.reasoning |
string |
否 |
思考过程 |
choices[].message.reasoning_content |
string |
否 |
思考过程,同 reasoning |
choices[].message.tool_calls |
array |
否 |
模型生成的工具调用 |
choices[].message.refusal |
string |
否 |
未生效,预留字段 |
choices[].message.audio |
string |
否 |
未生效,预留字段 |
choices[].message.annotations |
string |
否 |
未生效,预留字段 |
choices[].finish_reason |
string |
否 |
停止原因:stop 自然停止或命中停止序列;length 达到最大词元数;content_filter 内容被过滤;tool_calls 调用了工具;function_call 调用了函数(已弃用) |
choices[].stop_reason |
string |
否 |
模型内部的停止原因 |
choices[].logprobs |
object |
否 |
输出 token 的对数概率,未开启时为 null |
usage |
object |
是 |
token 统计 |
usage.completion_tokens |
int |
是 |
生成的 token 数 |
usage.prompt_tokens |
int |
是 |
prompt 的 token 数 |
usage.total_tokens |
int |
是 |
总 token 数 |
usage.completion_tokens_details |
object |
是 |
未生效,预留字段 |
prompt_logprobs |
string |
否 |
未生效,预留字段 |
4.2.3 失败返回字段
| 字段 |
类型 |
必填 |
说明 |
seq_id |
string |
是 |
请求异常时,返回该请求的 traceId(即请求入参中的 traceId) |
code |
string |
是 |
状态响应码,参考错误编码规范 |
message |
string |
是 |
调用结果描述,参考错误编码规范 |
created |
string |
是 |
时间戳 |
details |
string |
是 |
详细错误信息 |
五、状态码说明
5.1 算法状态码
| 状态码 |
状态描述 |
说明 |
解决方法 |
1000 |
请求成功 |
请求正常处理完成 |
执行下一步操作 |
1001 |
内部服务错误 |
服务内部异常 |
重试或联系服务台 |
1002 |
参数错误 |
入参校验未通过 |
按接口文档校验入参 |
1003 |
数据库没有查询到入库数据 |
未查询到对应的入库记录 |
检查请求是否已正确入库 |
1004 |
数据库设置收藏失败 |
收藏状态写入失败 |
重试或联系服务台 |
1005 |
大模型请求失败 |
模型推理请求失败 |
重试或联系服务台 |
5.2 公共状态码
- 接口响应的公共状态码由网关统一定义,一般用于标识鉴权失败、限流或服务异常,具体业务错误码、错误信息及排查建议请参考:开发指南-公共信息及状态码。
六、调用示例
6.1 请求示例
6.1.1 流式请求(纯文本)
{
"traceId": "955B307469CE4C749F0A964FEBAA6D1A",
"timestamp": 1749468686,
"model": "TeleAI/TeleMM",
"stream": true,
"stream_options": {
"include_usage": true
},
"chat_template_kwargs": {
"enable_thinking": false
},
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "1+2+3+4等于几"
}
]
}
]
}
6.1.2 流式请求(多模态)
{
"traceId": "955B307469CE4C749F0A964FEBAA6D1A",
"timestamp": 1749468686,
"model": "TeleAI/TeleMM",
"stream": true,
"stream_options": {
"include_usage": true
},
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What's in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,<图片 base64 编码>"
}
}
]
}
]
}
6.1.3 非流式请求
{
"traceId": "955B307469CE4C749F0A964FEBAA6D1A",
"timestamp": 1749468686,
"model": "TeleAI/TeleMM",
"stream": false,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "1+2+3+4等于几"
}
]
}
]
}
6.1.4 多轮对话
{
"traceId": "955B307469CE4C749F0A964FEBAA6D1A",
"timestamp": 1749468686,
"model": "TeleAI/TeleMM",
"stream": false,
"messages": [
{
"role": "user",
"content": "1+1=?"
},
{
"role": "assistant",
"content": "2"
},
{
"role": "user",
"content": "1+2?"
}
]
}
6.1.5 工具调用
{
"traceId": "955B307469CE4C749F0A964FEBAA6D1A",
"timestamp": 1749468686,
"model": "TeleAI/TeleMM",
"stream": false,
"n": 1,
"temperature": 0.1,
"frequency_penalty": 0,
"messages": [
{
"role": "user",
"content": "北京天气如何?"
}
],
"tool_choice": "auto",
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "获取指定地点的天气",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "城市名"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "温度单位"
}
},
"required": ["location"]
}
}
}
]
}
6.2 响应示例
6.2.1 非流式响应(有思考过程)
{
"id": "955B307469CE4C749F0A964FEBAA6D1A_chatcmpl-8ea040c5c2e4c7ee",
"choices": [
{
"index": 0,
"logprobs": null,
"finish_reason": "stop",
"stop_reason": null,
"message": {
"role": "assistant",
"content": "\n\n1+2+3+4 等于 10。",
"reasoning": "Thinking Process:\n\n1. Analyze the Request: ...\n2. Perform the Calculation: ...\n3. Formulate the Answer: ...",
"reasoning_content": "Thinking Process:\n\n1. Analyze the Request: ...\n2. Perform the Calculation: ...\n3. Formulate the Answer: ...",
"refusal": null,
"annotations": null,
"audio": null,
"tool_calls": []
}
}
],
"created": 1778812819,
"model": "TeleAI/TeleMM",
"object": "chat.completion",
"usage": {
"prompt_tokens": 19,
"completion_tokens": 344,
"total_tokens": 363,
"completion_tokens_details": null
},
"prompt_logprobs": null
}
说明:reasoning / reasoning_content 中的思考过程已用省略号压缩展示,实际返回为完整文本。
6.2.2 非流式响应(无思考过程)
{
"id": "955B307469CE4C749F0A964FEBAA6D1A_chatcmpl-a10e15315d4e7667",
"choices": [
{
"index": 0,
"logprobs": null,
"finish_reason": "stop",
"stop_reason": null,
"message": {
"role": "assistant",
"content": "计算 $1+2+3+4$ 的过程如下:\n\n1. 先算前两个数:$1 + 2 = 3$\n2. 加上第三个数:$3 + 3 = 6$\n3. 最后加上第四个数:$6 + 4 = 10$\n\n所以,$1+2+3+4$ 等于 **10**。",
"reasoning": null,
"reasoning_content": null,
"refusal": null,
"annotations": null,
"audio": null,
"tool_calls": []
}
}
],
"created": 1778812948,
"model": "TeleAI/TeleMM",
"object": "chat.completion",
"usage": {
"prompt_tokens": 21,
"completion_tokens": 88,
"total_tokens": 109,
"completion_tokens_details": null
},
"prompt_logprobs": null
}
6.2.3 流式响应
开启思考模式时,先返回 reasoning / reasoning_content 分块,再返回 content 正式结果;设置 stream_options.include_usage 为 true 时,data: [DONE] 前最后一块携带 usage。
data: {"id":"955B307469CE4C749F0A964FEBAA6D1A_chatcmpl-bdacf1313cea6b45","choices":[{"delta":{"content":"","reasoning":null,"reasoning_content":null,"refusal":null,"role":"assistant","tool_calls":null},"index":0,"logprobs":null,"finish_reason":null,"stop_reason":null}],"created":1778812976,"model":"TeleAI/TeleMM","object":"chat.completion.chunk","usage":null}
data: {"id":"955B307469CE4C749F0A964FEBAA6D1A_chatcmpl-bdacf1313cea6b45","choices":[{"delta":{"content":null,"reasoning":"Thinking","reasoning_content":"Thinking","refusal":null,"role":null,"tool_calls":null},"index":0,"logprobs":null,"finish_reason":null,"stop_reason":null}],"created":1778812976,"model":"TeleAI/TeleMM","object":"chat.completion.chunk","usage":null}
data: {"id":"955B307469CE4C749F0A964FEBAA6D1A_chatcmpl-bdacf1313cea6b45","choices":[{"delta":{"content":"\n\n","reasoning":null,"reasoning_content":null,"refusal":null,"role":null,"tool_calls":null},"index":0,"logprobs":null,"finish_reason":null,"stop_reason":null}],"created":1778812981,"model":"TeleAI/TeleMM","object":"chat.completion.chunk","usage":null}
data: {"id":"955B307469CE4C749F0A964FEBAA6D1A_chatcmpl-bdacf1313cea6b45","choices":[{"delta":{"content":"1","reasoning":null,"reasoning_content":null,"refusal":null,"role":null,"tool_calls":null},"index":0,"logprobs":null,"finish_reason":null,"stop_reason":null}],"created":1778812981,"model":"TeleAI/TeleMM","object":"chat.completion.chunk","usage":null}
<!-- 省略:中间为逐块增量返回 -->
data: {"id":"955B307469CE4C749F0A964FEBAA6D1A_chatcmpl-bdacf1313cea6b45","choices":[],"created":1778812981,"model":"TeleAI/TeleMM","object":"chat.completion.chunk","usage":{"completion_tokens":40,"prompt_tokens":23,"total_tokens":63,"completion_tokens_details":null}}
data: [DONE]
说明:SSE 流中以 data: 开头的行连续推送,此处省略了中间的增量分块;未开启 include_usage 时,最后一块不携带 usage。
6.3 Python
import requests
# 配置环境变量
X_APP_ID = "yourAppId"
AUTHORIZATION = "yourAuthorization"
# 请求地址
url = "https://api-maas.teleai.com.cn/aipaas/mllm/v1/telemm30b/completions"
request_data = {
"traceId": "955B307469CE4C749F0A964FEBAA6D1A",
"timestamp": 1749468686,
"model": "TeleAI/TeleMM",
"stream": True,
"stream_options": {"include_usage": True},
"chat_template_kwargs": {"enable_thinking": False},
"messages": [
{
"role": "user",
"content": [{"type": "text", "text": "1+2+3+4等于几"}]
}
]
}
# 构建请求头
headers = {
"Content-Type": "application/json",
"X-APP-ID": X_APP_ID,
"Authorization": AUTHORIZATION
}
def sse_client():
try:
response = requests.post(url, headers=headers, json=request_data, stream=True)
response.raise_for_status()
print("SSE连接已建立,开始接收事件...")
for line in response.iter_lines(decode_unicode=True):
if line:
print(f"收到数据: {line}")
except requests.exceptions.RequestException as e:
print(f"SSE请求异常: {e}")
except Exception as e:
print(f"处理异常: {e}")
if __name__ == "__main__":
sse_client()
6.4 Java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class Example {
public static void main(String[] args) {
try {
// 算法调用地址
URL url = new URL("https://api-maas.teleai.com.cn/aipaas/mllm/v1/telemm30b/completions");
// 设置请求头
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("X-APP-ID", "你的AppId");
connection.setRequestProperty("Authorization", "你的Authorization");
connection.setConnectTimeout(5000);
connection.setReadTimeout(60000);
connection.setDoOutput(true);
// 请求体参数
String requestBody = "{"
+ "\"traceId\":\"955B307469CE4C749F0A964FEBAA6D1A\","
+ "\"timestamp\":1749468686,"
+ "\"model\":\"TeleAI/TeleMM\","
+ "\"stream\":true,"
+ "\"stream_options\":{\"include_usage\":true},"
+ "\"chat_template_kwargs\":{\"enable_thinking\":false},"
+ "\"messages\":[{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"1+2+3+4等于几\"}]}]"
+ "}";
try (OutputStream os = connection.getOutputStream()) {
byte[] input = requestBody.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
// 读取 SSE 流
BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
System.out.println("收到数据: " + line);
}
reader.close();
connection.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
}