POST
/
files
/
upload
from together import Together
import os

client = Together(
api_key=os.environ.get("TOGETHER_API_KEY"),
)

current_dir = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(current_dir, "data.jsonl")
file = client.files.upload(file=file_path)

print(file.id)
{
  "id": "<string>",
  "object": "file",
  "created_at": 1715021438,
  "filename": "my_file.jsonl",
  "bytes": 2664,
  "purpose": "fine-tune",
  "Processed": true,
  "FileType": "jsonl",
  "LineCount": 123
}

Authorizations

Authorization
string
header
default:default
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data

Response

200
application/json

File uploaded successfully

The response is of type object.