Skip to main content

AI Gateway

Multimodal

Images, files, audio, and video through the same key and credits.

Images, documents, audio, and video are all available through the gateway with the same key and credits. Request and response shapes are the standard OpenAI-compatible ones; this page shows where each one lives.

NeedEndpointReference
Image or file input to a chat modelPOST /v1/chat/completions with content partsbelow
Parse an uploaded documentplugins: [{ "id": "file-parser" }]below
Generate an imagePOST /v1/imagesImages and video
Generate a videoPOST /v1/videos, then pollImages and video
Text to speech, musicPOST /v1/audio/speechAudio
Transcribe audioPOST /v1/audio/transcriptionsAudio
Upload and reuse a filePOST /v1/filesFiles

Image input

Send an image_url content part. Models that price image inputs show credits_per_image in the catalog.

curl --fail-with-body https://api.pre.dev/v1/chat/completions \
  -H "Authorization: Bearer $PREDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.8-flash",
    "messages": [{
      "role": "user",
      "content": [
        { "type": "text", "text": "Describe this image." },
        { "type": "image_url", "image_url": { "url": "https://pre.dev/predevlogosquare.png" } }
      ]
    }]
  }'
const completion = await client.chat.completions.create({
  model: 'google/gemini-3.8-flash',
  messages: [{
    role: 'user',
    content: [
      { type: 'text', text: 'Describe this image.' },
      { type: 'image_url', image_url: { url: 'https://pre.dev/predevlogosquare.png' } },
    ],
  }],
});
completion = client.chat.completions.create(
    model="google/gemini-3.8-flash",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Describe this image."},
            {"type": "image_url", "image_url": {"url": "https://pre.dev/predevlogosquare.png"}},
        ],
    }],
)

Documents

Attach a PDF or other document as a file content part and add the file-parser plugin so any model can read it:

{
  "model": "anthropic/claude-sonnet-5",
  "plugins": [{ "id": "file-parser" }],
  "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,JVBERi0xLjQK..." } }
    ]
  }]
}

Upload once with POST /v1/files when the same document is used across many calls. Files are scoped to the workspace that uploaded them.

Add plugins: [{ "id": "web" }], or append :online to the model id, and tune with web_search_options. Search cost is part of the call’s charge. See fallbacks and advanced options.

Generated images, video, and audio

Image, video, and speech models are listed by /v1/images/models, /v1/videos/models, and the main catalog. Video is asynchronous: submit, poll GET /v1/videos/{jobId}, then download from /content; the job is charged once it finishes, whether you poll it to completion, download its content, or stop polling and let pre.dev settle it. See images and video and audio.

Was this page helpful?

On this page