Skip to main content

Supported integration path

The Responses request represents content items in input; native forwarding can deliver input_file to an upstream that supports files. The example sends filename and Base64 Data URL file_data without a separate upload. A file_id must already be accessible to the target upstream; it is not portable across providers or accounts. This gateway’s /v1/files does not implement general file management. Native upstreams supporting file_url may impose their own download rules. This example reads a local file without downloading URLs, uploading files separately, or creating retrieval storage.

File and result boundaries

The example accepts one regular file up to 5 MiB and checks its %PDF- header before encoding. This does not establish that a PDF is complete, unencrypted, or parseable. The limit belongs to the example, not the gateway or upstream quota; Base64 increases request size. Check page count, size, model vision support, and deployment body limits before sending real documents. The project does not implement OpenRouter’s general file-parser OCR fallback. Scanned-page quality depends on the upstream; arbitrary text models do not acquire PDF support automatically. For large documents, extract and chunk content in your application and use RAG. The script makes one non-streaming request and prints an answer only after complete messages and final text. Refusals, tool calls, or incomplete results fail without retries. Raw files, paths, and opaque reasoning state are not printed, but answers may contain document content. See data controls for store: false. Local fixtures check encoding and protocol, not PDF understanding. Implementation sources: relaykit/dto/openai_request.go, relay/channel/openai/adaptor.go, and relaykit/relayconvert/internal/oai_responses/to_oai_chat_req.go. See upstream file inputs and Responses API.

Run the example

Run from the documentation directory with approved inputs and a capable model; first read the REST runtime. Keep the script and http-client.mjs together.
阅读中文