Skip to Content
API ReferenceFilesUpload file

Upload a file

Upload a file to the file service.

Endpoint

POST https://api.stepfun.ai/v1/files

Request body

  • purpose string required
    Upload intent. Only storage is supported for file uploads (image/video understanding, voice cloning, etc.).

  • url string optional
    Remote file URL. Supported formats match the file field. If both file and url are provided, file takes precedence.

  • file File optional
    File to upload. Each user can upload up to 1,000 files. Omit when using url.
    storage supported formats (max 128 MB):

    • Video (mp4)
    • Images (jpg/jpeg, png, webp, static gif)
    • Audio (mp3, wav). For voice cloning, audio length should be 5–10 seconds.

Response

Returns a single File object.

Examples

from openai import OpenAI client = OpenAI(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai/v1") client.files.create( file=open("productImage.png", "rb"), purpose="storage" )
Response
{ "id": "file-abc123", "object": "file", "bytes": 140, "created_at": 1613779121, "filename": "productImage.png", "purpose": "storage", "status":"processed" }
Last updated on