Create job
curl --request POST \
--url https://api.together.xyz/v1/fine-tunes \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"training_file": "<string>",
"model": "<string>",
"n_epochs": 1,
"n_checkpoints": 1,
"batch_size": 32,
"learning_rate": 0.00001,
"suffix": "<string>",
"wandb_api_key": "<string>"
}
'import requests
url = "https://api.together.xyz/v1/fine-tunes"
payload = {
"training_file": "<string>",
"model": "<string>",
"n_epochs": 1,
"n_checkpoints": 1,
"batch_size": 32,
"learning_rate": 0.00001,
"suffix": "<string>",
"wandb_api_key": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
training_file: '<string>',
model: '<string>',
n_epochs: 1,
n_checkpoints: 1,
batch_size: 32,
learning_rate: 0.00001,
suffix: '<string>',
wandb_api_key: '<string>'
})
};
fetch('https://api.together.xyz/v1/fine-tunes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.together.xyz/v1/fine-tunes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'training_file' => '<string>',
'model' => '<string>',
'n_epochs' => 1,
'n_checkpoints' => 1,
'batch_size' => 32,
'learning_rate' => 0.00001,
'suffix' => '<string>',
'wandb_api_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.together.xyz/v1/fine-tunes"
payload := strings.NewReader("{\n \"training_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_checkpoints\": 1,\n \"batch_size\": 32,\n \"learning_rate\": 0.00001,\n \"suffix\": \"<string>\",\n \"wandb_api_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.together.xyz/v1/fine-tunes")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"training_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_checkpoints\": 1,\n \"batch_size\": 32,\n \"learning_rate\": 0.00001,\n \"suffix\": \"<string>\",\n \"wandb_api_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.xyz/v1/fine-tunes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"training_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_checkpoints\": 1,\n \"batch_size\": 32,\n \"learning_rate\": 0.00001,\n \"suffix\": \"<string>\",\n \"wandb_api_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"training_file": "<string>",
"validation_file": "<string>",
"model": "<string>",
"model_output_name": "<string>",
"model_output_path": "<string>",
"TrainingFileNumLines": 123,
"TrainingFileSize": 123,
"created_at": "<string>",
"updated_at": "<string>",
"n_epochs": 123,
"n_checkpoints": 123,
"batch_size": 123,
"learning_rate": 123,
"eval_steps": 123,
"lora": true,
"lora_r": 123,
"lora_alpha": 123,
"lora_dropout": 123,
"job_id": "<string>",
"events": [
{
"object": "FinetuneEvent",
"created_at": "<string>",
"level": null,
"message": "<string>",
"type": "job_pending",
"param_count": 123,
"token_count": 123,
"wandb_url": "<string>",
"hash": "<string>"
}
],
"token_count": 123,
"param_count": 123,
"total_price": 123,
"epochs_completed": 123,
"queue_depth": 123,
"wandb_project_name": "<string>",
"wandb_url": "<string>"
}Fine-tuning
Create job
Use a model to create a fine-tuning job.
POST
/
fine-tunes
Create job
curl --request POST \
--url https://api.together.xyz/v1/fine-tunes \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"training_file": "<string>",
"model": "<string>",
"n_epochs": 1,
"n_checkpoints": 1,
"batch_size": 32,
"learning_rate": 0.00001,
"suffix": "<string>",
"wandb_api_key": "<string>"
}
'import requests
url = "https://api.together.xyz/v1/fine-tunes"
payload = {
"training_file": "<string>",
"model": "<string>",
"n_epochs": 1,
"n_checkpoints": 1,
"batch_size": 32,
"learning_rate": 0.00001,
"suffix": "<string>",
"wandb_api_key": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
training_file: '<string>',
model: '<string>',
n_epochs: 1,
n_checkpoints: 1,
batch_size: 32,
learning_rate: 0.00001,
suffix: '<string>',
wandb_api_key: '<string>'
})
};
fetch('https://api.together.xyz/v1/fine-tunes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.together.xyz/v1/fine-tunes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'training_file' => '<string>',
'model' => '<string>',
'n_epochs' => 1,
'n_checkpoints' => 1,
'batch_size' => 32,
'learning_rate' => 0.00001,
'suffix' => '<string>',
'wandb_api_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.together.xyz/v1/fine-tunes"
payload := strings.NewReader("{\n \"training_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_checkpoints\": 1,\n \"batch_size\": 32,\n \"learning_rate\": 0.00001,\n \"suffix\": \"<string>\",\n \"wandb_api_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.together.xyz/v1/fine-tunes")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"training_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_checkpoints\": 1,\n \"batch_size\": 32,\n \"learning_rate\": 0.00001,\n \"suffix\": \"<string>\",\n \"wandb_api_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.xyz/v1/fine-tunes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"training_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_checkpoints\": 1,\n \"batch_size\": 32,\n \"learning_rate\": 0.00001,\n \"suffix\": \"<string>\",\n \"wandb_api_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"training_file": "<string>",
"validation_file": "<string>",
"model": "<string>",
"model_output_name": "<string>",
"model_output_path": "<string>",
"TrainingFileNumLines": 123,
"TrainingFileSize": 123,
"created_at": "<string>",
"updated_at": "<string>",
"n_epochs": 123,
"n_checkpoints": 123,
"batch_size": 123,
"learning_rate": 123,
"eval_steps": 123,
"lora": true,
"lora_r": 123,
"lora_alpha": 123,
"lora_dropout": 123,
"job_id": "<string>",
"events": [
{
"object": "FinetuneEvent",
"created_at": "<string>",
"level": null,
"message": "<string>",
"type": "job_pending",
"param_count": 123,
"token_count": 123,
"wandb_url": "<string>",
"hash": "<string>"
}
],
"token_count": 123,
"param_count": 123,
"total_price": 123,
"epochs_completed": 123,
"queue_depth": 123,
"wandb_project_name": "<string>",
"wandb_url": "<string>"
}Authorizations
Body
application/json
File-ID of a file uploaded to the Together API
Name of the base model to run fine-tune job on
Number of epochs for fine-tuning
Number of checkpoints to save during fine-tuning
Batch size for fine-tuning
Learning rate multiplier to use for training
Suffix that will be added to your fine-tuned model name
API key for Weights & Biases integration
Response
200 - application/json
Fine-tuning job initiated successfully
Available options:
pending, queued, running, compressing, uploading, cancel_requested, cancelled, error, completed Show child attributes
Show child attributes