curl --request POST \
--url https://api.nugen.in/api/v3/models/{model_id}/export-hf \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"token": "<string>",
"hf_repo": "<string>",
"visibility": "private"
}
'import requests
url = "https://api.nugen.in/api/v3/models/{model_id}/export-hf"
payload = {
"token": "<string>",
"hf_repo": "<string>",
"visibility": "private"
}
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({token: '<string>', hf_repo: '<string>', visibility: 'private'})
};
fetch('https://api.nugen.in/api/v3/models/{model_id}/export-hf', 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.nugen.in/api/v3/models/{model_id}/export-hf",
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([
'token' => '<string>',
'hf_repo' => '<string>',
'visibility' => 'private'
]),
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.nugen.in/api/v3/models/{model_id}/export-hf"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"hf_repo\": \"<string>\",\n \"visibility\": \"private\"\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.nugen.in/api/v3/models/{model_id}/export-hf")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"hf_repo\": \"<string>\",\n \"visibility\": \"private\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/models/{model_id}/export-hf")
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 \"token\": \"<string>\",\n \"hf_repo\": \"<string>\",\n \"visibility\": \"private\"\n}"
response = http.request(request)
puts response.read_body{
"export_id": "<string>",
"model_id": "<string>",
"status": "QUEUED",
"message": "<string>"
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Export to Hugging Face
Export the aligned model’s weights to the given Hugging Face repository.
Path Parameters:
model_id: Unique identifier of the aligned model
Request Body:
hf_repo(optional): Target repository, e.g.org/model-name. Defaults to the token’s own namespace plus the model id.visibility:privateorpublictoken: Hugging Face access token
Runs in the background. Poll GET /models/{model_id}/export-hf/status
for progress. Export is open for base models within the supported size
range. Other sizes need an Enterprise licence and answer with status
FAILED and a message.
curl --request POST \
--url https://api.nugen.in/api/v3/models/{model_id}/export-hf \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"token": "<string>",
"hf_repo": "<string>",
"visibility": "private"
}
'import requests
url = "https://api.nugen.in/api/v3/models/{model_id}/export-hf"
payload = {
"token": "<string>",
"hf_repo": "<string>",
"visibility": "private"
}
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({token: '<string>', hf_repo: '<string>', visibility: 'private'})
};
fetch('https://api.nugen.in/api/v3/models/{model_id}/export-hf', 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.nugen.in/api/v3/models/{model_id}/export-hf",
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([
'token' => '<string>',
'hf_repo' => '<string>',
'visibility' => 'private'
]),
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.nugen.in/api/v3/models/{model_id}/export-hf"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"hf_repo\": \"<string>\",\n \"visibility\": \"private\"\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.nugen.in/api/v3/models/{model_id}/export-hf")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"hf_repo\": \"<string>\",\n \"visibility\": \"private\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/models/{model_id}/export-hf")
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 \"token\": \"<string>\",\n \"hf_repo\": \"<string>\",\n \"visibility\": \"private\"\n}"
response = http.request(request)
puts response.read_body{
"export_id": "<string>",
"model_id": "<string>",
"status": "QUEUED",
"message": "<string>"
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Your Nugen API key, sent as a Bearer token
Path Parameters
ID of the model, as listed by GET /models/aligned or GET /models/base
Body
Export an aligned model to a Hugging Face repository.
Hugging Face access token. Used only to perform the export; never logged or stored.
Target repository, e.g. org/model-name. Defaults to the token's own namespace plus the model id.
^([A-Za-z0-9][A-Za-z0-9._-]{0,95}/)?[A-Za-z0-9][A-Za-z0-9._-]{0,95}$private or public
private, public Response
Acknowledges the export request for the aligned model.
Acknowledgement of a Hugging Face export request.
Identifier of the export request. Poll status with it.
Aligned model the export was requested for.
Export request status.
QUEUED, PROCESSING, READY, FAILED, STOPPED Why the export was refused, when the status is FAILED.
Was this page helpful?