Skip to main content

Files API

Files are used to upload documents that can be used with features like Assistants, Fine-tuning, and Batch API.

Quick Start​

  • Upload a File
  • List Files
  • Retrieve File Information
  • Delete File
  • Get File Content
$ export OPENAI_API_KEY="sk-..."

$ litellm

# RUNNING on http://0.0.0.0:4000

Upload a File

curl http://localhost:4000/v1/files \
-H "Authorization: Bearer sk-1234" \
-F purpose="fine-tune" \
-F file="@mydata.jsonl"

List Files

curl http://localhost:4000/v1/files \
-H "Authorization: Bearer sk-1234"

Retrieve File Information

curl http://localhost:4000/v1/files/file-abc123 \
-H "Authorization: Bearer sk-1234"

Delete File

curl http://localhost:4000/v1/files/file-abc123 \
-X DELETE \
-H "Authorization: Bearer sk-1234"

Get File Content

curl http://localhost:4000/v1/files/file-abc123/content \
-H "Authorization: Bearer sk-1234"

Supported Providers:​

OpenAI​

Azure OpenAI​

Vertex AI​

Swagger API Reference​