Skip to main content
POST
/
api
/
repos
/
{namespace}
/
{repo_name}
/
fine_tunes
Create a fine-tune job
curl --request POST \
  --url https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/fine_tunes \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "base_model": "<string>",
  "resource": "<string>",
  "script_type": "<string>",
  "is_public": false,
  "oxen_model_path": "<string>",
  "training_params": {
    "batch_size": 123,
    "caption_column": "<string>",
    "gradient_accumulation": 123,
    "image_column": "<string>",
    "learning_rate": 123,
    "lora_alpha": 123,
    "lora_rank": 123,
    "sample_every": 123,
    "samples": 123,
    "steps": 123,
    "timestep_type": "<string>",
    "use_lora": true
  }
}
'
import requests

url = "https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/fine_tunes"

payload = {
"base_model": "<string>",
"resource": "<string>",
"script_type": "<string>",
"is_public": False,
"oxen_model_path": "<string>",
"training_params": {
"batch_size": 123,
"caption_column": "<string>",
"gradient_accumulation": 123,
"image_column": "<string>",
"learning_rate": 123,
"lora_alpha": 123,
"lora_rank": 123,
"sample_every": 123,
"samples": 123,
"steps": 123,
"timestep_type": "<string>",
"use_lora": True
}
}
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({
base_model: '<string>',
resource: '<string>',
script_type: '<string>',
is_public: false,
oxen_model_path: '<string>',
training_params: {
batch_size: 123,
caption_column: '<string>',
gradient_accumulation: 123,
image_column: '<string>',
learning_rate: 123,
lora_alpha: 123,
lora_rank: 123,
sample_every: 123,
samples: 123,
steps: 123,
timestep_type: '<string>',
use_lora: true
}
})
};

fetch('https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/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://hub.oxen.ai/api/repos/{namespace}/{repo_name}/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([
'base_model' => '<string>',
'resource' => '<string>',
'script_type' => '<string>',
'is_public' => false,
'oxen_model_path' => '<string>',
'training_params' => [
'batch_size' => 123,
'caption_column' => '<string>',
'gradient_accumulation' => 123,
'image_column' => '<string>',
'learning_rate' => 123,
'lora_alpha' => 123,
'lora_rank' => 123,
'sample_every' => 123,
'samples' => 123,
'steps' => 123,
'timestep_type' => '<string>',
'use_lora' => true
]
]),
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://hub.oxen.ai/api/repos/{namespace}/{repo_name}/fine_tunes"

payload := strings.NewReader("{\n \"base_model\": \"<string>\",\n \"resource\": \"<string>\",\n \"script_type\": \"<string>\",\n \"is_public\": false,\n \"oxen_model_path\": \"<string>\",\n \"training_params\": {\n \"batch_size\": 123,\n \"caption_column\": \"<string>\",\n \"gradient_accumulation\": 123,\n \"image_column\": \"<string>\",\n \"learning_rate\": 123,\n \"lora_alpha\": 123,\n \"lora_rank\": 123,\n \"sample_every\": 123,\n \"samples\": 123,\n \"steps\": 123,\n \"timestep_type\": \"<string>\",\n \"use_lora\": true\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://hub.oxen.ai/api/repos/{namespace}/{repo_name}/fine_tunes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_model\": \"<string>\",\n \"resource\": \"<string>\",\n \"script_type\": \"<string>\",\n \"is_public\": false,\n \"oxen_model_path\": \"<string>\",\n \"training_params\": {\n \"batch_size\": 123,\n \"caption_column\": \"<string>\",\n \"gradient_accumulation\": 123,\n \"image_column\": \"<string>\",\n \"learning_rate\": 123,\n \"lora_alpha\": 123,\n \"lora_rank\": 123,\n \"sample_every\": 123,\n \"samples\": 123,\n \"steps\": 123,\n \"timestep_type\": \"<string>\",\n \"use_lora\": true\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/fine_tunes")

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 \"base_model\": \"<string>\",\n \"resource\": \"<string>\",\n \"script_type\": \"<string>\",\n \"is_public\": false,\n \"oxen_model_path\": \"<string>\",\n \"training_params\": {\n \"batch_size\": 123,\n \"caption_column\": \"<string>\",\n \"gradient_accumulation\": 123,\n \"image_column\": \"<string>\",\n \"learning_rate\": 123,\n \"lora_alpha\": 123,\n \"lora_rank\": 123,\n \"sample_every\": 123,\n \"samples\": 123,\n \"steps\": 123,\n \"timestep_type\": \"<string>\",\n \"use_lora\": true\n }\n}"

response = http.request(request)
puts response.read_body
{
  "fine_tune": {
    "base_model": "<string>",
    "created_at": "<string>",
    "id": "<string>",
    "name": "<string>",
    "status": "<string>",
    "updated_at": "<string>"
  },
  "status": "<string>",
  "status_message": "<string>"
}
{}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Create fine-tune request

Request payload to create a fine-tune job for a repository.

base_model
string
required

Canonical name of the base model to fine-tune

resource
string
required

Repository path to the training data file or directory

script_type
string
required

Name of the fine-tune script to run

is_public
boolean
default:false

Whether the resulting fine-tuned model should be public. Defaults to false.

oxen_model_path
string | null

Optional override for where the resulting model weights live in Oxen. Defaults to the fine-tune resource.

training_params
object

Training configuration parameters

Response

Create fine-tune response

Standard wrapper for fine-tune responses.

fine_tune
FineTune · object

Fine-tune job resource

status
string

High-level status string (for example, 'success').

status_message
string

Human-readable status message (for example, 'resource_found').