Fine-tuning
Estimate price
Estimate the price of a fine-tuning job.
POST
Together AI SDK (Python)
Authorizations
Body
application/json
Response
Price estimated successfully
- Option 1
- Option 2
Together AI SDK (Python)
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Estimate the price of a fine-tuning job.
from together import Together
client = Together()
estimate = client.fine_tuning.estimate_price(
training_file="<FILE_ID>",
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Reference",
n_epochs=3,
training_method={"method": "sft", "train_on_inputs": "auto"},
training_type={"type": "Lora", "lora_r": 8, "lora_alpha": 16},
)
print(estimate)import Together from "together-ai";
const client = new Together();
const estimate = await client.fineTuning.estimatePrice({
training_file: "<FILE_ID>",
model: "meta-llama/Meta-Llama-3.1-8B-Instruct-Reference",
n_epochs: 3,
training_method: { method: "sft", train_on_inputs: "auto" },
training_type: { type: "Lora", lora_r: 8, lora_alpha: 16 },
});
console.log(estimate);
import Together from "together-ai";
const client = new Together();
const estimate = await client.fineTuning.estimatePrice({
training_file: "<FILE_ID>",
model: "meta-llama/Meta-Llama-3.1-8B-Instruct-Reference",
n_epochs: 3,
training_method: { method: "sft", train_on_inputs: "auto" },
training_type: { type: "Lora", lora_r: 8, lora_alpha: 16 },
});
console.log(estimate);
curl --request POST \
--url https://api.together.ai/v1/fine-tunes/estimate-price \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"training_file": "<string>",
"validation_file": "<string>",
"model": "<string>",
"n_epochs": 1,
"n_evals": 0,
"training_method": {
"method": "sft",
"train_on_inputs": "auto"
},
"training_type": {
"type": "Full"
},
"from_checkpoint": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.together.ai/v1/fine-tunes/estimate-price",
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>',
'validation_file' => '<string>',
'model' => '<string>',
'n_epochs' => 1,
'n_evals' => 0,
'training_method' => [
'method' => 'sft',
'train_on_inputs' => 'auto'
],
'training_type' => [
'type' => 'Full'
],
'from_checkpoint' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.ai/v1/fine-tunes/estimate-price"
payload := strings.NewReader("{\n \"training_file\": \"<string>\",\n \"validation_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_evals\": 0,\n \"training_method\": {\n \"method\": \"sft\",\n \"train_on_inputs\": \"auto\"\n },\n \"training_type\": {\n \"type\": \"Full\"\n },\n \"from_checkpoint\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.ai/v1/fine-tunes/estimate-price")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"training_file\": \"<string>\",\n \"validation_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_evals\": 0,\n \"training_method\": {\n \"method\": \"sft\",\n \"train_on_inputs\": \"auto\"\n },\n \"training_type\": {\n \"type\": \"Full\"\n },\n \"from_checkpoint\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.ai/v1/fine-tunes/estimate-price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"training_file\": \"<string>\",\n \"validation_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_evals\": 0,\n \"training_method\": {\n \"method\": \"sft\",\n \"train_on_inputs\": \"auto\"\n },\n \"training_type\": {\n \"type\": \"Full\"\n },\n \"from_checkpoint\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"estimation_available": true,
"estimated_total_price": 123,
"allowed_to_proceed": true,
"user_limit": 123,
"estimated_train_token_count": 123,
"estimated_eval_token_count": 123
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}Price estimated successfully
Was this page helpful?
from together import Together
client = Together()
estimate = client.fine_tuning.estimate_price(
training_file="<FILE_ID>",
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Reference",
n_epochs=3,
training_method={"method": "sft", "train_on_inputs": "auto"},
training_type={"type": "Lora", "lora_r": 8, "lora_alpha": 16},
)
print(estimate)import Together from "together-ai";
const client = new Together();
const estimate = await client.fineTuning.estimatePrice({
training_file: "<FILE_ID>",
model: "meta-llama/Meta-Llama-3.1-8B-Instruct-Reference",
n_epochs: 3,
training_method: { method: "sft", train_on_inputs: "auto" },
training_type: { type: "Lora", lora_r: 8, lora_alpha: 16 },
});
console.log(estimate);
import Together from "together-ai";
const client = new Together();
const estimate = await client.fineTuning.estimatePrice({
training_file: "<FILE_ID>",
model: "meta-llama/Meta-Llama-3.1-8B-Instruct-Reference",
n_epochs: 3,
training_method: { method: "sft", train_on_inputs: "auto" },
training_type: { type: "Lora", lora_r: 8, lora_alpha: 16 },
});
console.log(estimate);
curl --request POST \
--url https://api.together.ai/v1/fine-tunes/estimate-price \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"training_file": "<string>",
"validation_file": "<string>",
"model": "<string>",
"n_epochs": 1,
"n_evals": 0,
"training_method": {
"method": "sft",
"train_on_inputs": "auto"
},
"training_type": {
"type": "Full"
},
"from_checkpoint": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.together.ai/v1/fine-tunes/estimate-price",
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>',
'validation_file' => '<string>',
'model' => '<string>',
'n_epochs' => 1,
'n_evals' => 0,
'training_method' => [
'method' => 'sft',
'train_on_inputs' => 'auto'
],
'training_type' => [
'type' => 'Full'
],
'from_checkpoint' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.ai/v1/fine-tunes/estimate-price"
payload := strings.NewReader("{\n \"training_file\": \"<string>\",\n \"validation_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_evals\": 0,\n \"training_method\": {\n \"method\": \"sft\",\n \"train_on_inputs\": \"auto\"\n },\n \"training_type\": {\n \"type\": \"Full\"\n },\n \"from_checkpoint\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.ai/v1/fine-tunes/estimate-price")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"training_file\": \"<string>\",\n \"validation_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_evals\": 0,\n \"training_method\": {\n \"method\": \"sft\",\n \"train_on_inputs\": \"auto\"\n },\n \"training_type\": {\n \"type\": \"Full\"\n },\n \"from_checkpoint\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.ai/v1/fine-tunes/estimate-price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"training_file\": \"<string>\",\n \"validation_file\": \"<string>\",\n \"model\": \"<string>\",\n \"n_epochs\": 1,\n \"n_evals\": 0,\n \"training_method\": {\n \"method\": \"sft\",\n \"train_on_inputs\": \"auto\"\n },\n \"training_type\": {\n \"type\": \"Full\"\n },\n \"from_checkpoint\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"estimation_available": true,
"estimated_total_price": 123,
"allowed_to_proceed": true,
"user_limit": 123,
"estimated_train_token_count": 123,
"estimated_eval_token_count": 123
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}