普通模型
1. Chat Completions
请求说明
基本信息
- 请求地址:
https://model.sophnet.com/api/open-apis/v1/chat/completions - 请求方式:POST
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Content-Type | String | 是 | 固定值 application/json |
| Authorization | String | 是 | "Bearer " + API Key |
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型名称 |
| messages | array | 是 | 聊天上下文信息 |
| stream | bool | 否 | 是否流式返回,默认 false |
| max_tokens | integer | 否 | 模型回复最大长度 |
| temperature | number | 否 | 取值范围 [0, 2.0],默认 1.0 |
| tools | array | 否 | 工具列表,只支持 function |
请求示例
BASH
curl -X POST https://model.sophnet.com/api/open-apis/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "Qwen2.5-72B-Instruct",
"messages": [
{"role": "system", "content": "你是智能助手"},
{"role": "user", "content": "你可以帮我做些什么"}
]
}'Python SDK 示例
PYTHON
from openai import OpenAI
client = OpenAI(
api_key="API_KEY",
base_url="https://model.sophnet.com/api/open-apis/v1"
)
response = client.chat.completions.create(
model="Qwen2.5-72B-Instruct",
messages=[
{"role": "system", "content": "你是智能助手"},
{"role": "user", "content": "你可以帮我做些什么"},
]
)
print(response.choices[0].message.content)2. Embeddings
请求说明
基本信息
- 请求地址:
https://model.sophnet.com/api/open-apis/projects/easyllms/embeddings - 请求方式:POST
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Content-Type | String | 是 | 固定值 application/json |
| Authorization | String | 是 | "Bearer " + API Key |
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型名称,如 bge-m3、clip-embeddings |
| input_texts | array | 是 | 文本数组,每个文本最大 8192 Tokens |
| input_images | array | 否 | 图片 URL 数组,用于多模态向量模型(如 clip-embeddings) |
| dimensions | integer | 是 | 输出维度,如 1024 |
请求示例
BASH
curl --location --request POST 'https://model.sophnet.com/api/open-apis/projects/easyllms/embeddings' \
--header "Authorization: Bearer $API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"model": "bge-m3",
"input_texts": ["你好", "很高兴认识你"],
"dimensions": 1024
}'3. Document Parse
请求说明
基本信息
- 功能描述:高效转换主流格式文档至精准、易用的 Markdown 文本内容。上传文件,输出文档内容(Markdown)
- 请求地址:
https://model.sophnet.com/api/open-apis/projects/easyllms/doc-parse - 请求方式:POST
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Content-Type | String | 是 | 固定值 multipart/form-data |
| Authorization | String | 是 | "Bearer " + API Key |
form-data 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| file | file | 是 | 文档,支持 pdf, docx, doc, xlsx, txt, pptx 格式,大小 < 50MB |
请求示例
BASH
curl --location --request POST 'https://model.sophnet.com/api/open-apis/projects/easyllms/doc-parse' \ --header "Authorization: Bearer $API_KEY" \ --header "Content-Type: multipart/form-data" \ --form 'file=@"YOUR_DOCUMENT"'
响应示例
JSON
{
"data": "文件编号:HR-XXXX-XX-X-X\n\n发布单位:AMT\n\n发布对象:全员\n\n**管理制度**\n\n......"
}4. Image OCR
请求说明
基本信息
- 功能描述:图片 OCR 服务。发送图片,输出图片中的文本信息。
- 请求地址:
https://model.sophnet.com/api/open-apis/projects/easyllms/image-ocr - 请求方式:POST
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Content-Type | String | 是 | 固定值 application/json |
| Authorization | String | 是 | "Bearer " + API Key |
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型:PaddleOCR-VL-0.9B、PaddleOCR-VL-1.5 |
| type | string | 是 | 图片类型,固定为 "image_url" |
| image_url.url | string | 是 | 图片,可以是 base64 或 URL 链接 |
| prettify_markdown | boolean | 否 | 是否美化 Markdown 输出,默认 true |
| show_formula_number | boolean | 否 | 是否显示公式编号,默认 false |
请求示例
BASH
curl --location --request POST 'https://model.sophnet.com/api/open-apis/projects/easyllms/image-ocr' \
--header "Authorization: Bearer $API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"model": "PaddleOCR-VL-0.9B",
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,/9j/..."
},
"prettify_markdown": true,
"show_formula_number": false
}'响应示例
JSON
{
"status": 0,
"message": "请求成功",
"result": [
{
"label": "text",
"texts": "测试",
"position": "0,0,720,1920"
}
],
"markdown": { "text": "测试" }
}