OpenAI vs Anthropic shape
The ai& Files API is a single endpoint that responds in two shapes — selected by whether your request carries an anthropic-version header.
This means both the official openai SDK and the anthropic SDK work against the same URL, with the same API key, without any code changes.
Header-based shape selection
Section titled “Header-based shape selection”| Header | Response shape |
|---|---|
anthropic-version: <any> | Anthropic Files API shape |
| (header absent) | OpenAI Files API shape |
Example: same file, two shapes
Section titled “Example: same file, two shapes”curl https://api.aiand.com/v1/files/file-abc123 \ -H "Authorization: Bearer sk-..."{ "id": "file-abc123", "object": "file", "bytes": 12345, "created_at": 1716960000, "filename": "cat.png", "purpose": "vision"}curl https://api.aiand.com/v1/files/file-abc123 \ -H "Authorization: Bearer sk-..." \ -H "anthropic-version: 2023-06-01"{ "id": "file-abc123", "type": "file", "size_bytes": 12345, "created_at": "2026-05-18T12:00:00Z", "filename": "cat.png", "mime_type": "image/png"}What this enables
Section titled “What this enables”- The OpenAI Python SDK’s
client.files.create(...)works as-is. - The Anthropic Python SDK’s
client.beta.files.upload(...)works as-is. - You can upload via one SDK and read back via the other — same
file_ideither way.