Skip to main content
Attachments let you send file inputs (images, audio, PDFs, Markdown, …) to the Gateway. They can either be embedded as binary data or referenced with an URL.
Not every model supports every attachment type. Gateway passes attachments through to the provider, so unsupported types will return an error from the underlying model. Check /models and the provider docs for capability details.

From a URL (e.g. Markdown page)

If you have a file hosted on a URL, you can reference it directly in the message. The Vercel AI SDK will download it and then attach the binary to the message.
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";

const hebo = createOpenAICompatible({
  name: "hebo",
  apiKey: process.env.HEBO_API_KEY,
  baseURL: "https://gateway.hebo.ai/v1",
});

const { text } = await generateText({
  model: hebo("openai/gpt-oss-20b"),
  messages: [
    {
      role: "user",
      content: [
        {
          type: "text",
          text: "How to find out which models are supported by Hebo?",
        },
        {
          type: "file",
          data: new URL("https://hebo.ai/docs/gateway/supported-models.md"),
          mediaType: "text/markdown",
        },
      ],
    },
  ],
});

console.log(text);

From local File (e.g. Image)

If you already have a file locally, you can attach the binary data to the model call. Internally, it will automatically be converted to base64.
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
import { readFile } from "node:fs/promises";

const hebo = createOpenAICompatible({
  name: "hebo",
  apiKey: process.env.HEBO_API_KEY,
  baseURL: "https://gateway.hebo.ai/v1",
});

const { text } = await generateText({
  model: hebo("google/gemini-3-flash-preview"),
  messages: [
    {
      role: "user",
      content: [
        {
          type: "text",
          text: "Describe this image.",
        },
        {
          type: "image",
          image: await readFile("<FILENAME>"),
        },
      ],
    },
  ],
});

console.log(text);