---
title: "PDF and file reading for any model, with redaction"
canonical: https://relayswitch.io/features/files
generated: 2026-11-02T10:04:27.490Z
source: https://api.relayswitch.io/v1/catalog
base_url: https://api.relayswitch.io/v1
---

Files and redaction

# Any model reads the PDF. No model sees the secret.

Send documents in the shape your SDK uses; models that cannot read files get them as text. Turn on redaction and keys, tokens and personal data are swapped for placeholders before the prompt leaves.

[Get an agent key](https://app.relayswitch.io/console)[Code](#example)

From the live catalog

Models that read files natively

37

Models that get the text

304

File types

23

Largest file

20 MB

Pages read

first 50

Conversion

Free

## What it does for an agent

PDFs for every model

304 models read documents as text, 37 natively. The agent sends the same file part to all of them.

Office files and images

bmp, csv, docx, et, gif, htm, html, jpeg, jpg, md and 13 more types.

By URL or inline

A data URL, bare base64 or an https link. Private and loopback addresses are refused.

Secrets swapped out

API keys, tokens and private keys become \[\[SECRET\_1\]\] style placeholders before the request is forwarded.

Personal data too

secrets\_pii adds emails, phone numbers, card numbers, US SSNs and IBANs.

Answers stay readable

The originals are put back in the answer, so the agent works with real values and the model never saw them.

## Copy, paste, run

OpenAI SDK: a PDF to any model

python

1`import base64`

2`from openai import OpenAI`

3`import os`

4

5`client = OpenAI(`

6 `base_url="https://api.relayswitch.io/v1",`

7 `api_key=os.environ["RELAYSWITCH_API_KEY"],`

8`)`

9

10`pdf = base64.b64encode(open("contract.pdf", "rb").read()).decode()`

11`reply = client.chat.completions.create(`

12 `model="deepseek-v4.1-flash", # reads the PDF as text`

13 `messages=[{"role": "user", "content": [`

14 `{"type": "text", "text": "List every termination clause."},`

15 `{"type": "file", "file": {`

16 `"filename": "contract.pdf",`

17 `"file_data": f"data:application/pdf;base64,{pdf}",`

18 `}},`

19 `]}],`

20`)`

21`print(reply.choices[0].message.content)`

Anthropic SDK: a document by URL

python

1`import anthropic`

2`import os`

3

4`client = anthropic.Anthropic(`

5 `base_url="https://api.relayswitch.io/v1",`

6 `api_key=os.environ["RELAYSWITCH_API_KEY"],`

7`)`

8

9`reply = client.messages.create(`

10 `model="claude-sonnet-5-5",`

11 `max_tokens=1024,`

12 `messages=[{"role": "user", "content": [`

13 `{"type": "document", "source": {`

14 `"type": "url",`

15 `"url": "https://example.com/q3-report.pdf",`

16 `}},`

17 `{"type": "text", "text": "Summarize revenue by region."},`

18 `]}],`

19`)`

20`print(reply.content[0].text)`

curl: redact one request

bash

1`curl -i https://api.relayswitch.io/v1/chat/completions \`

2 `-H "Authorization: Bearer $RELAYSWITCH_API_KEY" \`

3 `-H "x-uplink-redact: secrets_pii" \`

4 `-H "Content-Type: application/json" \`

5 `-d '{"model": "deepseek-v4.1-flash", "messages": [{"role": "user",`

6 `"content": "Debug this: AWS_SECRET=... failed for jane@example.com"}]}'`

7`# The model sees [[SECRET_1]] and a placeholder for the email.`

8`# x-uplink-redactions: 2 The answer carries the originals back.`

Key API: redact by default

bash

1`# Every request on this agent's key, redacted by default.`

2`curl -X PATCH https://api.relayswitch.io/v1/keys/KEY_ID \`

3 `-H "Authorization: Bearer $ADMIN_KEY" \`

4 `-H "Content-Type: application/json" \`

5 `-d '{"redact": "secrets"}'`

## Models that read files natively

A sample from the live catalog, USD per million tokens.

| Model | Input | Output |
| --- | --- | --- |
| [Claude Fable 5](https://relayswitch.io/models/claude-fable-5) | $3.00 | $15.00 |
| [Claude Fable 5.1](https://relayswitch.io/models/claude-fable-5.1) | $6.00 | $30.00 |
| [Claude Haiku 4.5](https://relayswitch.io/models/claude-haiku-4-5) | $0.60 | $3.00 |
| [Claude Haiku 5.5](https://relayswitch.io/models/claude-haiku-5-5) | $0.06 | $0.15 |
| [Claude Opus 4.6](https://relayswitch.io/models/claude-opus-4-6) | $1.80 | $7.50 |
| [Claude Opus 4.7](https://relayswitch.io/models/claude-opus-4-7) | $1.80 | $7.50 |
| [Claude Opus 4.8](https://relayswitch.io/models/claude-opus-4-8) | $1.80 | $7.50 |
| [Claude Opus 5](https://relayswitch.io/models/claude-opus-5) | $1.80 | $7.50 |

Agent setup guides

-   [OpenClaw](https://relayswitch.io/guides/openclaw)
-   [Hermes Agent](https://relayswitch.io/guides/hermes-agent)
-   [OpenCode](https://relayswitch.io/guides/opencode)
-   [Claude Code](https://relayswitch.io/guides/claude-code)
-   [n8n](https://relayswitch.io/guides/n8n)

More features

-   [Agent tools](https://relayswitch.io/features/agent-tools)
-   [Routing](https://relayswitch.io/features/routing)
-   [Caching and compression](https://relayswitch.io/features/caching)
-   [Guardrails and sign-in](https://relayswitch.io/features/guardrails)
-   [MCP gateway](https://relayswitch.io/features/mcp-gateway)
-   [Endpoints](https://relayswitch.io/features/endpoints)
-   [Key budgets](https://relayswitch.io/features/key-budgets)
-   [Observability](https://relayswitch.io/features/observability)
-   [Hosted agents](https://relayswitch.io/agents)
-   [Workflows](https://relayswitch.io/workflows)
-   [Docs](https://relayswitch.io/docs)

FAQs

## Questions

For agent builders.

Open the console

A key in under a minute

[Get a key](https://app.relayswitch.io/console)

Or email [hello@relayswitch.io](mailto:hello@relayswitch.io)

### 

### 

### 

### 

### 

### 

## Hand your agent the documents

Every model reads them, and redaction keeps the secrets on your side.

[All features](https://relayswitch.io/features)[Get an agent key](https://app.relayswitch.io/console)

