Fine-Tune API
Create fine-tuned models using training data exported from your Xilos query log. Fine-tuning produces a custom model that can be imported back into Xilos as a routing target, giving you a model specialized for your use case.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /fine-tune/models | List available base models for fine-tuning |
POST | /fine-tune/create | Create a new fine-tune job |
GET | /fine-tune/jobs | List all fine-tune jobs |
List Base Models
GET /api/v1/fine-tune/modelsReturns the base models available for fine-tuning.
Response
[
{
"id": "gpt-4o",
"provider": "openai",
"display_name": "GPT-4o",
"context_window": 128000,
"supports_finetune": true
},
{
"id": "gpt-4o-mini",
"provider": "openai",
"display_name": "GPT-4o mini",
"context_window": 128000,
"supports_finetune": true
},
{
"id": "llama-3-1-8b",
"provider": "meta",
"display_name": "Llama 3.1 8B",
"context_window": 128000,
"supports_finetune": true
}
]cURL
curl https://api.xilos.ai/api/v1/fine-tune/models \
-H "Authorization: Bearer YOUR_X..._KEY"Create Fine-Tune Job
POST /api/v1/fine-tune/createRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
base_model | string | Yes | Base model ID from the available models list. |
training_data_file | string | Yes | File ID or URL of the exported training data (from Training Data API). |
name | string | Yes | Name for the resulting fine-tuned model. |
hyperparameters | object | No | Optional hyperparameters: epochs, batch_size, learning_rate. |
cURL
curl -X POST https://api.xilos.ai/api/v1/fine-tune/create \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_X..._KEY" \
-d '{
"base_model": "gpt-4o-mini",
"training_data_file": "file_01HXYZ",
"name": "My custom code model",
"hyperparameters": {
"epochs": 3,
"batch_size": 16
}
}'Response
{
"id": "ftjob_01HXYZ",
"name": "My custom code model",
"base_model": "gpt-4o-mini",
"status": "queued",
"created_at": "2025-01-15T10:30:00Z"
}Info: Fine-tune job statuses:
queued→running→succeededorfailed. Poll the jobs endpoint to track progress.
List Fine-Tune Jobs
GET /api/v1/fine-tune/jobsReturns all fine-tune jobs for your organization, including status and resulting model ID.
Response
[
{
"id": "ftjob_01HXYZ",
"name": "My custom code model",
"base_model": "gpt-4o-mini",
"status": "succeeded",
"result_model_id": "ft:gpt-4o-mini:custom-code:abc123",
"created_at": "2025-01-15T10:30:00Z",
"finished_at": "2025-01-15T12:45:00Z"
}
]cURL
curl https://api.xilos.ai/api/v1/fine-tune/jobs \
-H "Authorization: Bearer YOUR_X..._KEY"Fine-Tune Pipeline
Export Training Data
Use the Training Data API to export high-quality query-response pairs from your query log.
Choose a Base Model
List available base models and select one that matches your use case. Smaller models like gpt-4o-mini are faster and cheaper to fine-tune.
Create a Job
Submit a fine-tune job with your training data and base model. Monitor status until the job succeeds.
Import the Model
Once the job succeeds, the fine-tuned model appears in your model list. Add it as a routing target in your Routing Rules.
Evaluate
Use Eval Datasets to compare the fine-tuned model's performance against the base model.
Warning: Fine-tuning requires a sufficient volume of high-quality training data. We recommend at least 500 records with faithfulness and relevance scores of 0.8 or higher. See the Fine-Tuning Guide for detailed guidance.