多模态输入

支持图片、音频和文档输入

发送内容片段数组而不是字符串,接受该模态的模型将读取它们。同时支持 OpenAI 拼写和 Responses 拼写,位于 /v1/chat/completions:

部分支持来源
image_url / input_image图片{"url": "https://…"} 或 data:image/…;base64,… URL
input_audio音频剪辑{"data": "<base64>", "format": "wav"}
file / input_filePDF 或其他文档{"filename": "…", "file_data": "data:application/pdf;base64,…"}
import base64, os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OXYY_API_KEY"],
    base_url="https://api.oxyy.ai/v1"
)

# A public https URL, or a data URL you build yourself.
with open("chart.png", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

response = client.chat.completions.create(
    model="gemini-3-flash",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What does this chart show?"},
            {"type": "image_url", "image_url": {
                "url": f"data:image/png;base64,{b64}",
                "detail": "auto",
            }},
        ],
    }],
)
print(response.choices[0].message.content)
curl https://api.oxyy.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OXYY_API_KEY" \
  -d '{
    "model": "gemini-3-flash",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "Describe this image."},
        {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
      ]
    }]
  }'
# A PDF or other document rides in a `file` content part.
import base64, os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OXYY_API_KEY"],
    base_url="https://api.oxyy.ai/v1"
)

with open("contract.pdf", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

response = client.chat.completions.create(
    model="gemini-3-flash",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Summarise the termination clause."},
            {"type": "file", "file": {
                "filename": "contract.pdf",
                "file_data": f"data:application/pdf;base64,{b64}",
            }},
        ],
    }],
)
模型只读取其声明的内容。 每个模型都会列出其 inputModalities in GET /v1/models. 将图片附加到纯文本模型会被拒绝,而不是默默忽略,因为默默忽略的附件会产生一个毫无根据但充满自信的回答。每个文件的上限为:图片 20 MB,音频 50 MB,视频和文档 100 MB,运营商可以为每个模型设置更低的上限。
URL 由我们抓取,而非提供商。 您提供的 URL 会在调用提供商之前被下载、检查大小并内联,因此私有地址和回环地址会被拒绝。如果 URL 无法访问,您将收到 400 明确说明,而不是令人困惑的提供商错误。