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.
Markdown from a URL
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const hebo = createOpenAICompatible({
apiKey: process.env.HEBO_API_KEY,
baseURL: "https://gateway.hebo.ai/v1",
});
const file = await fetch("https://hebo.ai/docs/gateway/supported-models.md");
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 Uint8Array(await file.arrayBuffer()),
mimeType: "text/plain",
name: "supported-models.md",
},
],
},
],
});
Image from base64
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
import { readFile } from "node:fs/promises";
const hebo = createOpenAICompatible({
apiKey: process.env.HEBO_API_KEY,
baseURL: "https://gateway.hebo.ai/v1",
});
const imageBytes = await readFile("<FILENAME>");
const base64 = imageBytes.toString("base64");
await generateText({
model: hebo("google/gemini-3-flash-preview"),
messages: [
{
role: "user",
content: [
{ type: "text", text: "Describe this image." },
{
type: "image",
image: `data:image/png;base64,${base64}`,
},
],
},
],
});