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
purpose
enum<string>
required

The purpose of the file

Available options:
fine-tune,
eval,
eval-sample,
eval-output,
eval-summary,
batch-generated,
batch-api
Example:

"fine-tune"

file_name
string
required

The name of the file being uploaded

Example:

"dataset.csv"

file
file
required

The content of the file being uploaded

file_type
enum<string>
default:jsonl

The type of the file

Available options:
csv,
jsonl,
parquet
Example:

"jsonl"

Response

File uploaded successfully

id
string
required
object
string
required
Example:

"file"

created_at
integer
required
Example:

1715021438

filename
string
required
Example:

"my_file.jsonl"

bytes
integer
required
Example:

2664

purpose
enum<string>
required

The purpose of the file

Available options:
fine-tune,
eval,
eval-sample,
eval-output,
eval-summary,
batch-generated,
batch-api
Example:

"fine-tune"

Processed
boolean
required
FileType
enum<string>
default:jsonl
required

The type of the file

Available options:
csv,
jsonl,
parquet
Example:

"jsonl"

LineCount
integer
required