Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Files API

OpenAI-compatible file storage. Upload once, reference by file_id from the Responses API. PDFs, plain text, images — anything under 512 MB.

Endpoints

MethodPathPurpose
POST/v1/filesUpload
GET/v1/filesList
GET/v1/files/:idMetadata
GET/v1/files/:id/contentDownload bytes
DELETE/v1/files/:idDelete

All authenticated via the standard Authorization: Bearer $LAZU_API_KEY header.

Supported purposes

Every uploaded file must declare a purpose:

PurposeMax sizeAllowed mime typesWhat it's for
user_data512 MBAny non-executablePDFs, text, structured data passed to the model
vision20 MBimage/png, image/jpeg, image/gif, image/webpImage inputs

OpenAI's batch, fine-tune and assistants purposes are not yet supported — contact support if you need them.

Executable file extensions (.exe, .dll, .sh, .bat, …) are rejected regardless of purpose.

1. Upload

cURL

curl https://api.lazu.ai/v1/files \
  -H "Authorization: Bearer $LAZU_API_KEY" \
  -F purpose=user_data \
  -F file=@./paper.pdf

Response:

{
  "id": "file-lazu-01KSBV4MC6THZ9TCZEM38KPYRX",
  "object": "file",
  "bytes": 1609275,
  "created_at": 1779587764,
  "filename": "paper.pdf",
  "purpose": "user_data",
  "status": "processed"
}

Python (OpenAI SDK)

from openai import OpenAI
 
client = OpenAI(
    base_url="https://api.lazu.ai/v1",
    api_key="YOUR_LAZU_KEY",
)
 
with open("paper.pdf", "rb") as f:
    file = client.files.create(file=f, purpose="user_data")
 
print(file.id)

2. Reference from the Responses API

curl https://api.lazu.ai/v1/responses \
  -H "Authorization: Bearer $LAZU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": [{
      "role": "user",
      "content": [
        {"type": "input_text", "text": "Summarize this document"},
        {"type": "input_file", "file_id": "file-lazu-01KSBV4MC6THZ9TCZEM38KPYRX"}
      ]
    }]
  }'

For images, use "type": "input_image" instead of input_file.

3. List, retrieve, delete

# List all files for the current key
curl https://api.lazu.ai/v1/files \
  -H "Authorization: Bearer $LAZU_API_KEY"
 
# Metadata for one file
curl https://api.lazu.ai/v1/files/file-lazu-... \
  -H "Authorization: Bearer $LAZU_API_KEY"
 
# Download bytes
curl https://api.lazu.ai/v1/files/file-lazu-.../content \
  -H "Authorization: Bearer $LAZU_API_KEY" \
  -o downloaded.pdf
 
# Delete
curl -X DELETE https://api.lazu.ai/v1/files/file-lazu-... \
  -H "Authorization: Bearer $LAZU_API_KEY"

Retention & cleanup

  • Files are kept for 30 days from upload.
  • After 30 days, the file is deleted from storage and the database in a daily cleanup job (runs around 04:30 Asia/Shanghai).
  • You cannot extend retention from the public API. Re-upload if you need it to live longer.
  • Deleted files are gone — there is no soft delete / recycle bin.

Limits

LimitValue
Single file (user_data)512 MB
Single file (vision)20 MB
Total bytes dereferenced in one Responses call64 MB

If a Responses call references too many files (or files too large) and the total exceeds 64 MB, Lazu returns 400 with code file_too_large.

Errors

HTTPCodeMeaning
400missing_required_parameterForgot purpose
400purpose_not_supportedUsed batch / fine-tune / assistants
400invalid_requestMalformed multipart body / empty file
401invalid_api_keyAuth header missing or wrong
404file_not_foundfile_id doesn't exist or isn't owned by this key
413file_too_largeSingle file exceeds purpose's max size

See Errors for the full table.