Skip to main content
POST
https://api.cerebras.ai
/
v1
/
files
from cerebras.cloud.sdk import Cerebras
import os

client = Cerebras(
    api_key=os.environ.get("CEREBRAS_API_KEY"),
)

file = client.files.create(
    file=open("batch-requests.jsonl", "rb"),
    purpose="batch"
)

print(file)
{
  "id": "fileI72lQshwSO6Z7LIQ850CvA",
  "object": "file",
  "filename": "test.jsonl",
  "bytes": 4213,
  "purpose": "batch",
  "created_at": 1765172961,
  "expires_at": 1767764961
}
This feature is in Private Preview. For access or more information, contact us or reach out to your account representative.
Uploads a file for use with the Batch API. Files can be up to 200 MB and must be JSONL format. Files are retained for 7 days by default.

Request

file
file
required
The file to upload. Must be a binary file.
purpose
string
required
The intended purpose of the file. Currently supported values:
  • batch: Input file for batch processing
expires_after
object
The expiration policy for the file. Files with purpose=batch expire after 7 days by default.

Response

id
string
A unique identifier for the file.
object
string
The object type, which is always file.
filename
string
The name of the uploaded file.
purpose
string
The intended purpose of the file.
bytes
integer
The size of the file in bytes.
created_at
integer
The Unix timestamp (in seconds) of when the file was created.
expires_at
integer
The Unix timestamp (in seconds) of when the file will be automatically deleted.
from cerebras.cloud.sdk import Cerebras
import os

client = Cerebras(
    api_key=os.environ.get("CEREBRAS_API_KEY"),
)

file = client.files.create(
    file=open("batch-requests.jsonl", "rb"),
    purpose="batch"
)

print(file)
{
  "id": "fileI72lQshwSO6Z7LIQ850CvA",
  "object": "file",
  "filename": "test.jsonl",
  "bytes": 4213,
  "purpose": "batch",
  "created_at": 1765172961,
  "expires_at": 1767764961
}