import{c as r,z as s,e as n}from"./index-Bld7Uski.js";const a=(o,t)=>{const u=o.__vccOpts||o;for(const[e,q]of t)u[e]=q;return u},p={},l={class:"space-y-6"};function c(o,t){return n(),r("div",l,[...t[0]||(t[0]=[s(`

文档中心

常用格式说明与示例,复制即可使用

账户配置格式

accounts.json 或环境变量 ACCOUNTS_CONFIG 使用的 JSON 数组

[
  {
    "id": "account_1",
    "secure_c_ses": "CSE.Ad...",
    "csesidx": "498...",
    "config_id": "0cd...",
    "host_c_oses": "",
    "expires_at": "2026-12-31 23:59:59"
  }
]

必填:secure_c_ses / csesidx / config_id。id、host_c_oses、expires_at 可选。

API 对话 curl 格式

标准的 OpenAI 兼容格式,支持流式和非流式输出。

curl -X POST "http://localhost:7860/v1/chat/completions" \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -d '{
    "model": "gemini-2.5-flash",
    "stream": false,
    "temperature": 0.7,
    "top_p": 1,
    "messages": [
      { "role": "system", "content": "你是一个简洁的助手" },
      { "role": "user", "content": "你好,介绍一下这个项目" }
    ]
  }'

如果未设置 API Key,可省略 Authorization。

文生图格式(Base64 / URL 输出)

使用支持文生图的模型,直接给文本提示即可;输出格式由系统设置决定(base64 或 url)。

curl -X POST "http://localhost:7860/v1/chat/completions" \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -d '{
    "model": "gemini-3-pro-preview",
    "stream": true,
    "temperature": 0.7,
    "top_p": 1,
    "messages": [
      { "role": "user", "content": "生成一只戴着头盔的猫,赛博风格" }
    ]
  }'

图生图格式(Base64 / URL 输入)

content 使用多模态数组,image_url 可填 URL 或 data:base64。

curl -X POST "http://localhost:7860/v1/chat/completions" \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -d '{
    "model": "gemini-3-flash-preview",
    "stream": false,
    "temperature": 0.7,
    "top_p": 1,
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "把图片改成插画风格" },
          { "type": "image_url", "image_url": { "url": "https://example.com/cat.png" } }
        ]
      }
    ]
  }'
curl -X POST "http://localhost:7860/v1/chat/completions" \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -d '{
    "model": "gemini-3-flash-preview",
    "stream": false,
    "temperature": 0.7,
    "top_p": 1,
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "增强画面细节" },
          { "type": "image_url", "image_url": { "url": "data:image/png;base64,AAA..." } }
        ]
      }
    ]
  }'

读文件格式(URL / Base64)

适用于 PDF/图片/文本等可读文件,Word/PPT 等可能不支持会被提示转换。大部分文件都可能支持,建议自行测试。

curl -X POST "http://localhost:7860/v1/chat/completions" \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -d '{
    "model": "gemini-2.5-pro",
    "stream": false,
    "temperature": 0.7,
    "top_p": 1,
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "读取并总结这个文件" },
          { "type": "image_url", "image_url": { "url": "https://example.com/doc.pdf" } }
        ]
      }
    ]
  }'
curl -X POST "http://localhost:7860/v1/chat/completions" \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -d '{
    "model": "gemini-2.5-pro",
    "stream": false,
    "temperature": 0.7,
    "top_p": 1,
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "读取并摘要" },
          { "type": "image_url", "image_url": { "url": "data:application/pdf;base64,AAA..." } }
        ]
      }
    ]
  }'
`,1)])])}const i=a(p,[["render",c]]);export{i as default};