curl --request POST \
--url https://api.nugen.in/api/v3/alignment-projects/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alignment_name": "My Alignment Project",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": [
"document_01k4x9m2p7q3r5s8",
"document_01k4x9m2p7q3r5s9"
],
"workflow_id": "workflow-abc123",
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "This project aligns the model to extract and risk-flag contract clauses."
}
'import requests
url = "https://api.nugen.in/api/v3/alignment-projects/create"
payload = {
"alignment_name": "My Alignment Project",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": ["document_01k4x9m2p7q3r5s8", "document_01k4x9m2p7q3r5s9"],
"workflow_id": "workflow-abc123",
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "This project aligns the model to extract and risk-flag contract clauses."
}
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({
alignment_name: 'My Alignment Project',
base_model_id: 'Qwen/Qwen2.5-0.5B-Instruct',
document_ids: ['document_01k4x9m2p7q3r5s8', 'document_01k4x9m2p7q3r5s9'],
workflow_id: 'workflow-abc123',
benchmark_id: 'benchmark_01k4x9m2p7q3r6a1',
description: 'This project aligns the model to extract and risk-flag contract clauses.'
})
};
fetch('https://api.nugen.in/api/v3/alignment-projects/create', 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/alignment-projects/create",
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([
'alignment_name' => 'My Alignment Project',
'base_model_id' => 'Qwen/Qwen2.5-0.5B-Instruct',
'document_ids' => [
'document_01k4x9m2p7q3r5s8',
'document_01k4x9m2p7q3r5s9'
],
'workflow_id' => 'workflow-abc123',
'benchmark_id' => 'benchmark_01k4x9m2p7q3r6a1',
'description' => 'This project aligns the model to extract and risk-flag contract clauses.'
]),
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/alignment-projects/create"
payload := strings.NewReader("{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\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/alignment-projects/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/alignment-projects/create")
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 \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}"
response = http.request(request)
puts response.read_body{
"alignment_id": "alignment-project-123",
"status": "QUEUED",
"message": "Alignment already exists with the same configuration"
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create Alignment
Create a new domain alignment workflow.
This endpoint initiates a domain alignment workflow that aligns a base model to your domain corpus using provided documents.
Request Body:
alignment_name: Name of the domain alignment projectbase_model_id: Base model to use for alignment (e.g.,Qwen/Qwen2.5-0.5B-Instruct)document_ids: List of document IDs the synthetic training dataset is generated from. Documents are snapshotted when the project is created; later edits to documents never change an existing alignmentworkflow_id(optional): Custom workflow identifierbenchmark_id(optional, recommended): When passed, your aligned model is evaluated automatically against this benchmark. Skip it to evaluate later withPOST /evaluations/create, or not at all.description(optional): Description of the alignment project
More control:
This endpoint plans the alignment for you. If you want a say in how it runs, send your best estimates to POST /api/v3/alignment-projects/{alignment_id}/auto-align: a target score, a compute budget, and any settings you already have a view on, such as the policy objective (PPO, CISPO or DRO), the advantage estimator, the reward source, the reference-policy KL target or the rollout group size. Rough estimates are enough to start. Anything you leave out, the system plans for you.
Importing models:
The examples use small Qwen models, and the same call works for almost any open language model on Hugging Face, including families such as Llama, Qwen, Phi, Mistral and DeepSeek, and new releases as they appear. GET /api/v3/models/base lists the base models you can align right now. To use another one, import it once with POST /api/v3/models/base/import, then pass its Hugging Face id as base_model_id. For security reasons, models that require custom code execution are unsupported by default; raise a support ticket to discuss your case.
Returns:
alignment_id: Unique alignment identifier for tracking workflow progressstatus: Initial workflow status (alwaysQUEUED)
Raises:
400: If the base model does not support alignment404: If document IDs are not found or don’t belong to user409: If your organisation already has 10 alignment projects; delete one first
Example Request:
POST /api/v3/alignment-projects/create
Headers: {"Authorization": "Bearer <api_key>"}
{
"alignment_name": "Contract Risk Domain Alignment",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": ["document_01k4x9m2p7q3r5se", "document_01k4x9m2p7q3r5sf", "document_01k4x9m2p7q3r5sg"],
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "Alignment for master services agreements and addenda"
}
Example Response:
{
"alignment_id":"alignment_01k4x9m2p7q3r8c1",
"status": "QUEUED"
}
Notes:
- Use
/alignment-projects/{id}/statusto track workflow progress - If
benchmark_idis provided, an evaluation is created once train-time alignment finishes. The alignment is READY at that point; follow the evaluation atGET /evaluations/{evaluation_id} - Only models that support alignment can be used.
curl --request POST \
--url https://api.nugen.in/api/v3/alignment-projects/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alignment_name": "My Alignment Project",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": [
"document_01k4x9m2p7q3r5s8",
"document_01k4x9m2p7q3r5s9"
],
"workflow_id": "workflow-abc123",
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "This project aligns the model to extract and risk-flag contract clauses."
}
'import requests
url = "https://api.nugen.in/api/v3/alignment-projects/create"
payload = {
"alignment_name": "My Alignment Project",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": ["document_01k4x9m2p7q3r5s8", "document_01k4x9m2p7q3r5s9"],
"workflow_id": "workflow-abc123",
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "This project aligns the model to extract and risk-flag contract clauses."
}
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({
alignment_name: 'My Alignment Project',
base_model_id: 'Qwen/Qwen2.5-0.5B-Instruct',
document_ids: ['document_01k4x9m2p7q3r5s8', 'document_01k4x9m2p7q3r5s9'],
workflow_id: 'workflow-abc123',
benchmark_id: 'benchmark_01k4x9m2p7q3r6a1',
description: 'This project aligns the model to extract and risk-flag contract clauses.'
})
};
fetch('https://api.nugen.in/api/v3/alignment-projects/create', 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/alignment-projects/create",
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([
'alignment_name' => 'My Alignment Project',
'base_model_id' => 'Qwen/Qwen2.5-0.5B-Instruct',
'document_ids' => [
'document_01k4x9m2p7q3r5s8',
'document_01k4x9m2p7q3r5s9'
],
'workflow_id' => 'workflow-abc123',
'benchmark_id' => 'benchmark_01k4x9m2p7q3r6a1',
'description' => 'This project aligns the model to extract and risk-flag contract clauses.'
]),
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/alignment-projects/create"
payload := strings.NewReader("{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\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/alignment-projects/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/alignment-projects/create")
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 \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}"
response = http.request(request)
puts response.read_body{
"alignment_id": "alignment-project-123",
"status": "QUEUED",
"message": "Alignment already exists with the same configuration"
}{
"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
Body
Create an alignment project that fine-tunes a base model on your documents.
Name of the domain alignment project
"My Alignment Project"
Hugging Face id of the base model to align. Any model listed by GET /api/v3/models/base, or imported with POST /api/v3/models/base/import, can be used.
"Qwen/Qwen2.5-0.5B-Instruct"
List of document IDs to train the alignment on
[
"document_01k4x9m2p7q3r5s8",
"document_01k4x9m2p7q3r5s9"
]
This id is to orchestrate the entire flow
"workflow-abc123"
Benchmark ID for evaluation (created via /benchmarks/create or /benchmarks/upload)
"benchmark_01k4x9m2p7q3r6a1"
Optional project description
"This project aligns the model to extract and risk-flag contract clauses."
Response
Returns a unique identifier for the initiated domain alignment workflow along with the initial workflow status. This endpoint starts an asynchronous alignment run over a base model to your domain corpus using provided documents and optional benchmark evaluation, allowing users to track progress and retrieve results once completed.
Response schema for alignment project creation endpoint
Created alignment project identifier
"alignment-project-123"
Initial alignment project status
QUEUED, PROCESSING, READY, FAILED, STOPPED "QUEUED"
Additional context about the response
"Alignment already exists with the same configuration"
Was this page helpful?