Skip to main content
Beta
BetaServer tools are currently in beta. The API and behavior may change.
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.
Requires the file-ids headerThe files tool requires the x-openrouter-file-ids: openrouter request header and an authenticated workspace. Without the header, tool calls return an error to the model.

Quick Start

Configuration

The files tool has no configuration options — which workspace and files it can access is determined by your API key and the x-openrouter-file-ids header, 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 is currently no separate charge for the files tool; you pay only for standard token usage.

Next Steps