curl --request POST \
--url https://api.nixtla.io/v2/finetune \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"series": {
"y": [
123
],
"sizes": [
123
],
"X_future": [
[
123
]
],
"X": [
[
123
]
],
"categorical_exog": [
1
]
},
"freq": "<string>",
"model": "timegpt-1",
"finetune_steps": 10,
"finetune_loss": "default",
"finetune_depth": 1,
"output_model_id": "<string>",
"finetuned_model_id": "<string>",
"hist_exog": [
1
],
"multivariate": false,
"model_parameters": {}
}
'import requests
url = "https://api.nixtla.io/v2/finetune"
payload = {
"series": {
"y": [123],
"sizes": [123],
"X_future": [[123]],
"X": [[123]],
"categorical_exog": [1]
},
"freq": "<string>",
"model": "timegpt-1",
"finetune_steps": 10,
"finetune_loss": "default",
"finetune_depth": 1,
"output_model_id": "<string>",
"finetuned_model_id": "<string>",
"hist_exog": [1],
"multivariate": False,
"model_parameters": {}
}
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({
series: {y: [123], sizes: [123], X_future: [[123]], X: [[123]], categorical_exog: [1]},
freq: '<string>',
model: 'timegpt-1',
finetune_steps: 10,
finetune_loss: 'default',
finetune_depth: 1,
output_model_id: '<string>',
finetuned_model_id: '<string>',
hist_exog: [1],
multivariate: false,
model_parameters: {}
})
};
fetch('https://api.nixtla.io/v2/finetune', 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.nixtla.io/v2/finetune",
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([
'series' => [
'y' => [
123
],
'sizes' => [
123
],
'X_future' => [
[
123
]
],
'X' => [
[
123
]
],
'categorical_exog' => [
1
]
],
'freq' => '<string>',
'model' => 'timegpt-1',
'finetune_steps' => 10,
'finetune_loss' => 'default',
'finetune_depth' => 1,
'output_model_id' => '<string>',
'finetuned_model_id' => '<string>',
'hist_exog' => [
1
],
'multivariate' => false,
'model_parameters' => [
]
]),
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.nixtla.io/v2/finetune"
payload := strings.NewReader("{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X_future\": [\n [\n 123\n ]\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ]\n },\n \"freq\": \"<string>\",\n \"model\": \"timegpt-1\",\n \"finetune_steps\": 10,\n \"finetune_loss\": \"default\",\n \"finetune_depth\": 1,\n \"output_model_id\": \"<string>\",\n \"finetuned_model_id\": \"<string>\",\n \"hist_exog\": [\n 1\n ],\n \"multivariate\": false,\n \"model_parameters\": {}\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.nixtla.io/v2/finetune")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X_future\": [\n [\n 123\n ]\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ]\n },\n \"freq\": \"<string>\",\n \"model\": \"timegpt-1\",\n \"finetune_steps\": 10,\n \"finetune_loss\": \"default\",\n \"finetune_depth\": 1,\n \"output_model_id\": \"<string>\",\n \"finetuned_model_id\": \"<string>\",\n \"hist_exog\": [\n 1\n ],\n \"multivariate\": false,\n \"model_parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixtla.io/v2/finetune")
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 \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X_future\": [\n [\n 123\n ]\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ]\n },\n \"freq\": \"<string>\",\n \"model\": \"timegpt-1\",\n \"finetune_steps\": 10,\n \"finetune_loss\": \"default\",\n \"finetune_depth\": 1,\n \"output_model_id\": \"<string>\",\n \"finetuned_model_id\": \"<string>\",\n \"hist_exog\": [\n 1\n ],\n \"multivariate\": false,\n \"model_parameters\": {}\n}"
response = http.request(request)
puts response.read_body{
"input_tokens": 1,
"output_tokens": 1,
"finetune_tokens": 1,
"finetuned_model_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Foundational Time Series Model Multi Series Finetuning
Fine-tune the large time model to your data and save it for later use. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the ID of the finetuned model, which you can provide in other endpoints to use that model to make the forecasts. Get your token for private beta at https://www.nixtla.io/book-a-free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference.
curl --request POST \
--url https://api.nixtla.io/v2/finetune \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"series": {
"y": [
123
],
"sizes": [
123
],
"X_future": [
[
123
]
],
"X": [
[
123
]
],
"categorical_exog": [
1
]
},
"freq": "<string>",
"model": "timegpt-1",
"finetune_steps": 10,
"finetune_loss": "default",
"finetune_depth": 1,
"output_model_id": "<string>",
"finetuned_model_id": "<string>",
"hist_exog": [
1
],
"multivariate": false,
"model_parameters": {}
}
'import requests
url = "https://api.nixtla.io/v2/finetune"
payload = {
"series": {
"y": [123],
"sizes": [123],
"X_future": [[123]],
"X": [[123]],
"categorical_exog": [1]
},
"freq": "<string>",
"model": "timegpt-1",
"finetune_steps": 10,
"finetune_loss": "default",
"finetune_depth": 1,
"output_model_id": "<string>",
"finetuned_model_id": "<string>",
"hist_exog": [1],
"multivariate": False,
"model_parameters": {}
}
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({
series: {y: [123], sizes: [123], X_future: [[123]], X: [[123]], categorical_exog: [1]},
freq: '<string>',
model: 'timegpt-1',
finetune_steps: 10,
finetune_loss: 'default',
finetune_depth: 1,
output_model_id: '<string>',
finetuned_model_id: '<string>',
hist_exog: [1],
multivariate: false,
model_parameters: {}
})
};
fetch('https://api.nixtla.io/v2/finetune', 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.nixtla.io/v2/finetune",
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([
'series' => [
'y' => [
123
],
'sizes' => [
123
],
'X_future' => [
[
123
]
],
'X' => [
[
123
]
],
'categorical_exog' => [
1
]
],
'freq' => '<string>',
'model' => 'timegpt-1',
'finetune_steps' => 10,
'finetune_loss' => 'default',
'finetune_depth' => 1,
'output_model_id' => '<string>',
'finetuned_model_id' => '<string>',
'hist_exog' => [
1
],
'multivariate' => false,
'model_parameters' => [
]
]),
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.nixtla.io/v2/finetune"
payload := strings.NewReader("{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X_future\": [\n [\n 123\n ]\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ]\n },\n \"freq\": \"<string>\",\n \"model\": \"timegpt-1\",\n \"finetune_steps\": 10,\n \"finetune_loss\": \"default\",\n \"finetune_depth\": 1,\n \"output_model_id\": \"<string>\",\n \"finetuned_model_id\": \"<string>\",\n \"hist_exog\": [\n 1\n ],\n \"multivariate\": false,\n \"model_parameters\": {}\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.nixtla.io/v2/finetune")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X_future\": [\n [\n 123\n ]\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ]\n },\n \"freq\": \"<string>\",\n \"model\": \"timegpt-1\",\n \"finetune_steps\": 10,\n \"finetune_loss\": \"default\",\n \"finetune_depth\": 1,\n \"output_model_id\": \"<string>\",\n \"finetuned_model_id\": \"<string>\",\n \"hist_exog\": [\n 1\n ],\n \"multivariate\": false,\n \"model_parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixtla.io/v2/finetune")
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 \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X_future\": [\n [\n 123\n ]\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ]\n },\n \"freq\": \"<string>\",\n \"model\": \"timegpt-1\",\n \"finetune_steps\": 10,\n \"finetune_loss\": \"default\",\n \"finetune_depth\": 1,\n \"output_model_id\": \"<string>\",\n \"finetuned_model_id\": \"<string>\",\n \"hist_exog\": [\n 1\n ],\n \"multivariate\": false,\n \"model_parameters\": {}\n}"
response = http.request(request)
puts response.read_body{
"input_tokens": 1,
"output_tokens": 1,
"finetune_tokens": 1,
"finetuned_model_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
HTTPBearer
Body
Show child attributes
Show child attributes
The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available.
Model to use as a string. Common options are (but not restricted to) timegpt-1 and timegpt-1-long-horizon. Full options vary by different users. Contact support@nixtla.io for more information. We recommend using timegpt-1-long-horizon for forecasting if you want to predict more than one seasonal period given the frequency of your data.
The number of tuning steps used to train the large time model on the data. Set this value to 0 for zero-shot inference, i.e., to make predictions without any further model tuning.
x >= 0The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape', 'poisson']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers.
default, mae, mse, rmse, mape, smape, poisson The depth of the finetuning. Uses a scale from 1 to 5, where 1 means little finetuning, and 5 means that the entire model is finetuned. Note that this parameter is only effective for timegpt-1 and timegpt-1-long-horizon models, meanwhile it has no effect on the other models. By default, the value is set to 1.
1, 2, 3, 4, 5 ID to assign to the finetuned model
^[a-zA-Z0-9\-_]{1,36}$ID of previously finetuned model
^[a-zA-Z0-9\-_]{1,36}$Zero-based indices of the exogenous features to treat as historical.
x >= 0Compute multivariate predictions across a batch of multiple time series. Requires all time series with overlapping dates. Note that this is only effective for timegpt-2.1 model and it has no effect on the other models. By default, the value is set to False.
Optional dictionary of parameters to customize the behavior of the large time model.
Was this page helpful?