pydo.files.create()

Generated on 3 Aug 2026 from pydo version v0.40.0

Usage

client.files.create(
    file="batch_requests.jsonl",
    purpose="batch",
)
Returns JSONRaises HttpResponseError

Serverless inference methods can authenticate with a model access key instead of a DigitalOcean API token:

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

Description

Creates a file record and returns a file_id plus a short-lived presigned PUT URL (typically valid for ~15 minutes). Upload the raw JSONL bytes to upload_url (see PUT /{upload_path}) before calling POST /v1/batches.

Parameters

file string or bytes required

File content. Accepts a filesystem path, raw bytes, a readable stream, or a (name, data) tuple.

purpose string optional

Free-form label retained on the returned object. Default: "batch".

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

uploaded = client.files.create(
    file="batch_requests.jsonl",
    purpose="batch",
)
print(uploaded.file_id)

Response Example

Show Response Example
{
  "file_id": "a1b2c3d4-e5f6-4789-90ab-cdef12345678",
  "upload_url": "https://batch-inference.nyc3.digitaloceanspaces.com/uploads/a1b2c3d4-e5f6-4789-90ab-cdef12345678.jsonl?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=...",
  "expires_at": "2026-04-24T19:34:19Z"
}

More Information

See /v1/batches/files in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.