Estimate FP4 preparation cost
curl --request POST \
--url https://api.together.ai/v1/shaping/prepare-for-fp4-inference/estimate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"adapter_object_id": "ml_CeG3fF6pyEViU8dE8pk7R",
"adapter_revision_id": "rv_CeG3faPBj2ABwbAaHPTmx",
"calibration_file_id": "file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35"
}
}
'import requests
url = "https://api.together.ai/v1/shaping/prepare-for-fp4-inference/estimate"
payload = { "inputs": {
"adapter_object_id": "ml_CeG3fF6pyEViU8dE8pk7R",
"adapter_revision_id": "rv_CeG3faPBj2ABwbAaHPTmx",
"calibration_file_id": "file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
inputs: {
adapter_object_id: 'ml_CeG3fF6pyEViU8dE8pk7R',
adapter_revision_id: 'rv_CeG3faPBj2ABwbAaHPTmx',
calibration_file_id: 'file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35'
}
})
};
fetch('https://api.together.ai/v1/shaping/prepare-for-fp4-inference/estimate', 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.ai/v1/shaping/prepare-for-fp4-inference/estimate",
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([
'inputs' => [
'adapter_object_id' => 'ml_CeG3fF6pyEViU8dE8pk7R',
'adapter_revision_id' => 'rv_CeG3faPBj2ABwbAaHPTmx',
'calibration_file_id' => 'file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35'
]
]),
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/shaping/prepare-for-fp4-inference/estimate"
payload := strings.NewReader("{\n \"inputs\": {\n \"adapter_object_id\": \"ml_CeG3fF6pyEViU8dE8pk7R\",\n \"adapter_revision_id\": \"rv_CeG3faPBj2ABwbAaHPTmx\",\n \"calibration_file_id\": \"file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35\"\n }\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/shaping/prepare-for-fp4-inference/estimate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"adapter_object_id\": \"ml_CeG3fF6pyEViU8dE8pk7R\",\n \"adapter_revision_id\": \"rv_CeG3faPBj2ABwbAaHPTmx\",\n \"calibration_file_id\": \"file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.ai/v1/shaping/prepare-for-fp4-inference/estimate")
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 \"inputs\": {\n \"adapter_object_id\": \"ml_CeG3fF6pyEViU8dE8pk7R\",\n \"adapter_revision_id\": \"rv_CeG3faPBj2ABwbAaHPTmx\",\n \"calibration_file_id\": \"file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35\"\n }\n}"
response = http.request(request)
puts response.read_body{
"price_usd": 28.76,
"time_hours": 4,
"credit_limit": 500,
"allowed_to_proceed": true
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}FP4 preparation
Estimate FP4 preparation cost
Reports the price and expected wall-clock time for preparing the named adapter without creating a job. The request body is the same as POST /shaping/prepare-for-fp4-inference, so a caller can price exactly the job it is about to submit.
POST
/
shaping
/
prepare-for-fp4-inference
/
estimate
Estimate FP4 preparation cost
curl --request POST \
--url https://api.together.ai/v1/shaping/prepare-for-fp4-inference/estimate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"adapter_object_id": "ml_CeG3fF6pyEViU8dE8pk7R",
"adapter_revision_id": "rv_CeG3faPBj2ABwbAaHPTmx",
"calibration_file_id": "file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35"
}
}
'import requests
url = "https://api.together.ai/v1/shaping/prepare-for-fp4-inference/estimate"
payload = { "inputs": {
"adapter_object_id": "ml_CeG3fF6pyEViU8dE8pk7R",
"adapter_revision_id": "rv_CeG3faPBj2ABwbAaHPTmx",
"calibration_file_id": "file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
inputs: {
adapter_object_id: 'ml_CeG3fF6pyEViU8dE8pk7R',
adapter_revision_id: 'rv_CeG3faPBj2ABwbAaHPTmx',
calibration_file_id: 'file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35'
}
})
};
fetch('https://api.together.ai/v1/shaping/prepare-for-fp4-inference/estimate', 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.ai/v1/shaping/prepare-for-fp4-inference/estimate",
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([
'inputs' => [
'adapter_object_id' => 'ml_CeG3fF6pyEViU8dE8pk7R',
'adapter_revision_id' => 'rv_CeG3faPBj2ABwbAaHPTmx',
'calibration_file_id' => 'file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35'
]
]),
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/shaping/prepare-for-fp4-inference/estimate"
payload := strings.NewReader("{\n \"inputs\": {\n \"adapter_object_id\": \"ml_CeG3fF6pyEViU8dE8pk7R\",\n \"adapter_revision_id\": \"rv_CeG3faPBj2ABwbAaHPTmx\",\n \"calibration_file_id\": \"file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35\"\n }\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/shaping/prepare-for-fp4-inference/estimate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"adapter_object_id\": \"ml_CeG3fF6pyEViU8dE8pk7R\",\n \"adapter_revision_id\": \"rv_CeG3faPBj2ABwbAaHPTmx\",\n \"calibration_file_id\": \"file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.ai/v1/shaping/prepare-for-fp4-inference/estimate")
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 \"inputs\": {\n \"adapter_object_id\": \"ml_CeG3fF6pyEViU8dE8pk7R\",\n \"adapter_revision_id\": \"rv_CeG3faPBj2ABwbAaHPTmx\",\n \"calibration_file_id\": \"file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35\"\n }\n}"
response = http.request(request)
puts response.read_body{
"price_usd": 28.76,
"time_hours": 4,
"credit_limit": 500,
"allowed_to_proceed": true
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Request body for preparing an adapter for FP4 inference.
Adapter inputs to prepare.
Show child attributes
Show child attributes
Example:
{
"adapter_object_id": "ml_CeG3fF6pyEViU8dE8pk7R",
"adapter_revision_id": "rv_CeG3faPBj2ABwbAaHPTmx",
"calibration_file_id": "file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35"
}
Response
Estimate for the described job.
Price and duration estimate for a quantization job.
Expected total run cost in US dollars.
Example:
28.76
Expected wall-clock run time in hours, excluding queue time.
Example:
4
Project credit limit in US dollars.
Example:
500
Whether a create request at this price would be accepted.
Example:
true
Was this page helpful?
⌘I