Wir verwenden Cookies. Cookies und Browserspeicher halten Sie angemeldet und merken sich Ihre Einstellungen. Mit Ihrer Zustimmung messen wir außerdem, wie die Website genutzt wird. Sie können jederzeit . Siehe unsere Cookie-Richtlinie.

Vision & Dateien

Endpunkte

Vision & Dateien

Senden Sie Bilder, PDFs, Audio und Video als Content-Parts einer Chat-Nachricht an multimodale Modelle, inklusive Beispielen, Limits und Fehlern.

Im Playground testen

Multimodale Modelle akzeptieren Bilder, PDFs, Audio und Video in einer Nutzernachricht. Übergeben Sie content als Array von Parts statt als String. Was ein Modell akzeptiert, sehen Sie unter architecture.input_modalities in Modelle (image, file, audio, video).

Content-Parts

PartFormHinweise
Text{ "type": "text", "text": "..." }
Bild{ "type": "image_url", "image_url": { "url": "https://..." | "data:image/png;base64,...", "detail": "auto" } }PNG, JPEG, WebP, GIF. URL oder Base64-Data-URL.
PDF / Datei{ "type": "file", "file": { "filename": "doc.pdf", "file_data": "https://..." | "data:application/pdf;base64,..." } }Funktioniert mit jedem Modell. Modelle ohne native Dateiunterstützung erhalten geparsten Text.
Audio{ "type": "input_audio", "input_audio": { "data": "<base64>", "format": "wav" } }Nur Base64. wav, mp3 und weitere, je nach Modell.
Video{ "type": "video_url", "video_url": { "url": "https://..." } }Von einigen Modellen unterstützt, z. B. Gemini.
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api14.com/api/v1",
  apiKey: process.env.API14_API_KEY,
});

const result = await client.chat.completions.create({
  "model": "openai/gpt-5-mini",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
          }
        }
      ]
    }
  ]
});
console.log(result.choices[0].message.content);

Bildbeispiel

{
  "model": "google/gemini-2.5-flash",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "What is in this picture?" },
        { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg" } }
      ]
    }
  ]
}

PDF-Beispiel

{
  "model": "anthropic/claude-sonnet-4.5",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "Summarize this contract in five bullets." },
        { "type": "file", "file": { "filename": "contract.pdf", "file_data": "data:application/pdf;base64,JVBERi0xLjcK..." } }
      ]
    }
  ],
  "plugins": [{ "id": "file-parser", "pdf": { "engine": "pdf-text" } }]
}

Das optionale Plugin file-parser legt fest, wie ein PDF gelesen wird: pdf-text (kostenlose Textextraktion), mistral-ocr (OCR für Scans, pro Seite abgerechnet) oder native (das Modell liest die Datei selbst). Die Parsing-Kosten sind Teil von usage.cost.

Antwort

Die Antwort ist eine normale Chat Completion. Bild-, Datei- und Audioeingaben zählen als Eingabe-Tokens, und ihre Kosten stehen in usage.cost:

{
  "choices": [{ "index": 0, "finish_reason": "stop", "message": { "role": "assistant", "content": "A close-up of an ant on a leaf." } }],
  "usage": { "prompt_tokens": 1290, "completion_tokens": 12, "total_tokens": 1302, "cost": 0.000417 }
}

Limits & Fehler

  • Ein Request-Body darf höchstens 25 MB groß sein. Base64 macht Dateien etwa 33 % größer. Größere Anfragen liefern 413 payload_too_large. Verwenden Sie bei großen Bildern öffentliche URLs.
  • Ein Modell, das einen Eingabetyp nicht akzeptiert, liefert ein Upstream-400 oder 404.
  • Andere Fehler entsprechen denen von Chat Completions. Siehe Fehler.