Skip to main content
POST /openai/files uploads a local file and returns a file object with a signed url. Pass that url in any *_url content part instead of a base64 data URI. The route needs an API key: an anonymous call returns 401. The upload follows the OpenAI Files request shape: a multipart form with file and an optional purpose. The reply adds url, which the OpenAI Files API does not return.
The request uploads invoice.pdf, then reads it page by page with paddleocr/pp-ocrv6 through the returned url.

The file object

Use the url

  • Chat Completions: in an image_url, video_url, document_url, or file_url part.
  • Embeddings: in any *_url part the model accepts.
  • Transcriptions: in the url form field of POST /openai/audio/transcriptions.
A file id is not a content part. When a url expires, call GET /openai/files/{file_id} with the same key for a new one.
The request returns the same file object with a fresh url.

Access and cost

An upload is not billed. The call that reads the url bills as usual. An MCP client with no API key gets an upload token from create_upload_token. The token is valid for one upload.

Errors

Next steps

Supported Inputs

Content part types and per-modality limits.

MCP Tools

create_upload_token for agents with no API key.