Skip to main content
Beta
BetaServer tools are currently in beta. The API and behavior may change.The files tool and the Files API are available on the global endpoint (openrouter.ai) only. Requests through the in-region endpoints (eu.openrouter.ai, us.openrouter.ai) are rejected; the Files API returns a 403 there.
The openrouter:files server tool lets a model read, write, edit, and list text files in your workspace via the OpenRouter Files API. When the model needs file access (reading an uploaded document, saving output, or applying a targeted edit), it calls the tool and OpenRouter executes the operation server-side.
The tool sees one workspace: your key’sThe files it can list, read, write, and edit are the ones in the workspace your API key is scoped to. A key with no workspace gets your default workspace, not necessarily the one you uploaded through in the dashboard. If the model reports a file it should be able to see as missing, check which workspace the key belongs to first.

Quick start

Configuration

The files tool has no configuration options. Which workspace and files it can access is determined by your API key, so enabling the tool takes only its type:

Operations

The model generates the call arguments. Each call performs one operation:

Call arguments

Edits are copy-on-writeEditing a file creates a new copy with a new file_id; the original file is left unchanged.

Response

The tool returns { "result": ... } on success with the operation’s output (file listing, file content, or the new file’s metadata), or { "error": "..." } when the operation fails (for example, when a required field is missing or the target file isn’t found). The model reads the error and can retry with corrected arguments.

Pricing

There’s currently no separate charge for the files tool; you pay only for standard token usage.

Next steps