mirror of
https://github.com/whit3rabbit/anyllm-proxy.git
synced 2026-09-22 16:00:51 +00:00
Rust workspace with two crates: - translator: pure, IO-free mapping between Anthropic Messages API and OpenAI Chat Completions - proxy: axum HTTP server with auth, streaming SSE, retry/backoff, concurrency limits 169 tests passing (unit, golden fixture, integration). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
55 lines
1.4 KiB
Markdown
55 lines
1.4 KiB
Markdown
# File and Document Handling Differences
|
|
|
|
## Anthropic Document Blocks
|
|
|
|
Anthropic supports inline documents in message content:
|
|
```json
|
|
{
|
|
"type": "document",
|
|
"source": {
|
|
"type": "base64",
|
|
"media_type": "application/pdf",
|
|
"data": "<base64>"
|
|
},
|
|
"title": "report.pdf"
|
|
}
|
|
```
|
|
|
|
Also supports image blocks with base64 or URL sources.
|
|
|
|
## OpenAI File Handling
|
|
|
|
### Chat Completions
|
|
- Supports `image_url` content parts (URL or data URI)
|
|
- No inline document/PDF support
|
|
- Files must be uploaded separately via `/v1/files` API
|
|
|
|
### Responses API
|
|
- Supports `input_file` with `file_data` (base64), `file_id`, or `file_url`
|
|
- This would be the ideal target for document translation
|
|
|
|
## Current Translation
|
|
|
|
| Anthropic Block | OpenAI Translation | Fidelity |
|
|
|---|---|---|
|
|
| Image (base64) | `image_url` with data URI | Full |
|
|
| Image (URL) | `image_url` with URL | Full |
|
|
| Document (base64 PDF) | Text note placeholder | Lossy |
|
|
|
|
### Document Translation Detail
|
|
|
|
Since the proxy targets Chat Completions (not Responses), documents are converted to a text note:
|
|
```
|
|
[Attached report.pdf: application/pdf (12345 bytes base64)]
|
|
```
|
|
|
|
This is a known limitation. Full document support would require targeting the Responses API with `input_file.file_data`.
|
|
|
|
## Size Limits
|
|
|
|
| Provider | Limit |
|
|
|---|---|
|
|
| Anthropic Messages | 32 MB |
|
|
| Anthropic Batch | 256 MB |
|
|
| Proxy | 32 MB (enforced at edge) |
|