mirror of
https://github.com/whit3rabbit/anyllm-proxy.git
synced 2026-09-21 16:00:49 +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>
1.4 KiB
1.4 KiB
File and Document Handling Differences
Anthropic Document Blocks
Anthropic supports inline documents in message content:
{
"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_urlcontent parts (URL or data URI) - No inline document/PDF support
- Files must be uploaded separately via
/v1/filesAPI
Responses API
- Supports
input_filewithfile_data(base64),file_id, orfile_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) |