Get Started
Examples
Concepts
Resources
Projects
Integrations
API Reference
Handling Files
copy markdown
Pass files as base64, binary file object or URL in prompt with URL context understanding.
File size limits
- URL in prompt: 80 MB
- Base64: 20 MB
- Binary file object: 20 MB
URL
Pass a publicly accessible file URL directly in the prompt text. The model fetches and reads the file at inference time.
This is great for handling large files that don't fit in the context window.
Interfaze SDK
Vercel AI SDK
LangChain SDK
const response = await interfaze.chat.completions.create({
messages: [
{
role: "user",
content: "Summarize this document for me: https://arxiv.org/pdf/2602.04101",
},
],
});
console.log(response.choices[0]?.message.content);Base64
Follows the same pattern as OpenAI file handling SDK.
Read a local file, encode it as base64, and pass it in the message content using the file content type.
Interfaze SDK
Vercel AI SDK
LangChain SDK
import { inputs } from "interfaze";
const response = await interfaze.chat.completions.create({
messages: [
{
role: "user",
content: [
// reads the local file and builds the data URI for you
inputs.file(await inputs.fromPath("document.pdf"), { filename: "document.pdf" }),
{
type: "text",
text: "Summarize this document.",
},
],
},
],
});
console.log(response.choices[0]?.message.content);Binary File Object
Read a file as a binary Buffer or Blob (TypeScript) / bytes (Python) and pass it directly in the message. The SDK handles serialization automatically.
LangChain content parts take a string, so encode the bytes as a data URI before passing them along.
Interfaze SDK
Vercel AI SDK
LangChain SDK
import { inputs } from "interfaze";
import fs from "fs";
const fileBuffer = fs.readFileSync("document.pdf");
const response = await interfaze.chat.completions.create({
messages: [
{
role: "user",
content: [
inputs.file(await inputs.dataUrl(fileBuffer, "application/pdf"), { filename: "document.pdf" }),
{
type: "text",
text: "Summarize this document.",
},
],
},
],
});
console.log(response.choices[0]?.message.content);