Skip to main content

Intelligence Foundry API (1.0.0)

Download OpenAPI specification:Download

The Intelligence Foundry REST API. Please see https://docs.crusoecloud.com/ for more details.

Fine-tuning

Create fine-tuning job

Creates a fine-tuning job which begins the process of creating a new model from a given dataset.

Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.

Learn more about fine-tuning

Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
required
string or Preset (string)

The name of the model to fine-tune. You can select one of the supported models.

training_file
required
string

The ID of an uploaded file that contains training data.

See upload file for how to upload a file.

Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose fine-tune.

The contents of the file should differ depending on if the model uses the chat, completions format, or if the fine-tuning method uses the preference format.

See the fine-tuning guide for more details.

object

The hyperparameters used for the fine-tuning job. This value is now deprecated in favor of method, and should be passed in under the method parameter.

suffix
string or null [ 1 .. 64 ] characters ^[a-zA-Z0-9][a-zA-Z0-9-]*$

A string of up to 64 characters that will be added to your fine-tuned model name.

For example, a suffix of "custom-model-name" would produce a model name like ft:gpt-4o-mini:openai:custom-model-name:7p4lURel.

validation_file
string or null

The ID of an uploaded file that contains validation data.

If you provide this file, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in the fine-tuning results file. The same data should not be present in both train and validation files.

Your dataset must be formatted as a JSONL file. You must upload your file with the purpose fine-tune.

See the fine-tuning guide for more details.

seed
integer or null [ 0 .. 2147483647 ]

The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases. If a seed is not specified, one will be generated for you.

object (FineTuneMethod)

The method used for fine-tuning. Only supervised is supported.

(object or null) or (object or null) (Metadata)

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Responses

Request samples

Content type
application/json
{
  • "model": "gpt-4o-mini",
  • "training_file": "file-abc123",
  • "hyperparameters": {
    },
  • "suffix": "string",
  • "validation_file": "file-abc123",
  • "seed": 42,
  • "method": {
    },
  • "metadata": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "created_at": 0,
  • "error": {
    },
  • "fine_tuned_model": "string",
  • "finished_at": 0,
  • "hyperparameters": {
    },
  • "model": "string",
  • "object": "fine_tuning.job",
  • "organization_id": "string",
  • "result_files": [
    ],
  • "status": "validating_files",
  • "trained_tokens": 0,
  • "training_file": "string",
  • "validation_file": "string",
  • "seed": 0,
  • "estimated_finish": 0,
  • "method": {
    },
  • "metadata": {
    }
}

List fine-tuning jobs

List your organization's fine-tuning jobs

Authorizations:
ApiKeyAuth
query Parameters
model
Array of strings

Filter to jobs for these base model registry IDs.

suffix
Array of strings

Filter to jobs with these suffixes.

status
Array of strings
Items Enum: "validating_files" "queued" "running" "succeeded" "failed" "cancelled"

Filter to jobs in these statuses.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "has_more": true,
  • "object": "list"
}

Retrieve fine-tuning job

Get info about a fine-tuning job.

Learn more about fine-tuning

Authorizations:
ApiKeyAuth
path Parameters
fine_tuning_job_id
required
string

The ID of the fine-tuning job.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "created_at": 0,
  • "error": {
    },
  • "fine_tuned_model": "string",
  • "finished_at": 0,
  • "hyperparameters": {
    },
  • "model": "string",
  • "object": "fine_tuning.job",
  • "organization_id": "string",
  • "result_files": [
    ],
  • "status": "validating_files",
  • "trained_tokens": 0,
  • "training_file": "string",
  • "validation_file": "string",
  • "seed": 0,
  • "estimated_finish": 0,
  • "method": {
    },
  • "metadata": {
    }
}

List fine-tuning checkpoints

List checkpoints for a fine-tuning job.

Authorizations:
ApiKeyAuth
path Parameters
fine_tuning_job_id
required
string

The ID of the fine-tuning job to get checkpoints for.

query Parameters
after
string

Identifier for the last checkpoint ID from the previous pagination request.

limit
integer
Default: 10

Number of checkpoints to retrieve.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "object": "list",
  • "first_id": "string",
  • "last_id": "string",
  • "has_more": true
}

Cancel fine-tuning

Immediately cancel a fine-tune job.

Authorizations:
ApiKeyAuth
path Parameters
fine_tuning_job_id
required
string

The ID of the fine-tuning job to cancel.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "created_at": 0,
  • "error": {
    },
  • "fine_tuned_model": "string",
  • "finished_at": 0,
  • "hyperparameters": {
    },
  • "model": "string",
  • "object": "fine_tuning.job",
  • "organization_id": "string",
  • "result_files": [
    ],
  • "status": "validating_files",
  • "trained_tokens": 0,
  • "training_file": "string",
  • "validation_file": "string",
  • "seed": 0,
  • "estimated_finish": 0,
  • "method": {
    },
  • "metadata": {
    }
}

List fine-tuning events

Get status updates for a fine-tuning job.

Authorizations:
ApiKeyAuth
path Parameters
fine_tuning_job_id
required
string

The ID of the fine-tuning job to get events for.

query Parameters
after
string

Identifier for the last event from the previous pagination request.

limit
integer
Default: 20

Number of events to retrieve.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "object": "list",
  • "has_more": true
}

Get fine-tuning job metrics

Get time-series training metrics for a fine-tuning job.

Authorizations:
ApiKeyAuth
path Parameters
fine_tuning_job_id
required
string

The ID of the fine-tuning job to get metrics for.

query Parameters
metric_names
Array of strings
Items Enum: "ev_loss" "ev_eval_loss" "ev_current_step" "ev_total_steps" "ev_learning_rate" "ev_grad_norm" "ev_num_input_tokens_seen" "ev_eval_samples_per_second" "ev_eval_steps_per_second" "ev_estimated_finish" "ev_train_loss" "ev_train_runtime" "ev_train_samples_per_second" "ev_train_steps_per_second" "ev_train_tokens_per_second" "ev_total_flos"

Filter to specific metric names.

cursor
string

Epoch timestamp cursor for pagination.

step
string

Step duration for aggregation (e.g. 1m, 30s).

x_axis
string
Enum: "timestamp" "step_count"

X-axis type for returned data points (default timestamp).

Responses

Response samples

Content type
application/json
{
  • "object": "fine_tuning.job.metrics",
  • "fine_tuning_job_id": "string",
  • "x_axis": "timestamp",
  • "metrics": [
    ]
}

Files

List files

Returns a list of files.

Authorizations:
ApiKeyAuth
query Parameters
purpose
string

Only return files with the given purpose.

limit
integer
Default: 10000

A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.

order
string
Default: "desc"
Enum: "asc" "desc"

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

after
string

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

Responses

Response samples

Content type
application/json
{
  • "object": "list",
  • "data": [
    ],
  • "first_id": "file-abc123",
  • "last_id": "file-abc456",
  • "has_more": false
}

Upload file

Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 1 TB.

  • The Assistants API supports files up to 2 million tokens and of specific file types. See the Assistants Tools guide for details.
  • The Fine-tuning API only supports .jsonl files. The input also has certain required formats for fine-tuning chat or completions models.
  • The Batch API only supports .jsonl files up to 200 MB in size. The input also has a specific required format.

Please contact us if you need to increase these storage limits.

Authorizations:
ApiKeyAuth
Request Body schema: multipart/form-data
required
file
required
string <binary>

The File object (not file name) to be uploaded.

purpose
required
string (FilePurpose)
Enum: "fine-tune" "batch"

The intended purpose of the file. Supported values are fine-tune and batch.

object (File expiration policy)

The expiration policy for a file. By default, files with purpose=batch expire after 30 days and all other files are persisted until they are manually deleted.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "bytes": 0,
  • "created_at": 0,
  • "expires_at": 0,
  • "filename": "string",
  • "object": "file",
  • "purpose": "assistants",
  • "status": "uploaded",
  • "status_details": "string",
  • "is_cmek_encrypted": false
}

Retrieve file

Returns information about a specific file.

Authorizations:
ApiKeyAuth
path Parameters
file_id
required
string

The ID of the file to use for this request.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "bytes": 0,
  • "created_at": 0,
  • "expires_at": 0,
  • "filename": "string",
  • "object": "file",
  • "purpose": "assistants",
  • "status": "uploaded",
  • "status_details": "string",
  • "is_cmek_encrypted": false
}

Delete file

Delete a file and remove it from all vector stores.

Authorizations:
ApiKeyAuth
path Parameters
file_id
required
string

The ID of the file to use for this request.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "object": "file",
  • "deleted": true
}

Retrieve file content

Returns the contents of the specified file.

Authorizations:
ApiKeyAuth
path Parameters
file_id
required
string

The ID of the file to use for this request.

Responses

Response samples

Content type
application/json
"string"

Models

List available models

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "object": "list",
  • "data": [
    ]
}

Retrieve a model

Retrieves a model instance, providing basic information about the model such as the owner and availability.

Authorizations:
ApiKeyAuth
path Parameters
model
required
string

The encoded ID of the model (returned in the id field from list)

Responses

Response samples

Content type
application/json
{
  • "id": "admin-model-abc123",
  • "object": "model",
  • "owned_by": "org-123",
  • "model_source": "huggingface",
  • "model_name": "meta-llama/Llama-2-7b-hf",
  • "model_revision": "main",
  • "globally_available": false,
  • "project_ids": [
    ],
  • "inference_available": true,
  • "fine_tuning_available": false,
  • "model_type": "base_model",
  • "base_model_id": "model-abc123",
  • "created": 1700000000
}

Delete a fine-tuned model

Delete a fine-tuned model owned by the caller's project. Refuses deletion of globally available models, models not solely owned by the caller's project, or models referenced by any non-terminal fine-tuning job in the project.

Authorizations:
ApiKeyAuth
path Parameters
model
required
string

The encoded ID of the model (returned in the id field from list)

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "object": "model",
  • "deleted": true
}

Download an adapter model

Download an adapter model as a zip archive containing adapter_model.safetensors and adapter_config.json. Requires ProjectReader permission.

Authorizations:
ApiKeyAuth
path Parameters
model
required
string

The ID of the adapter model to download

Responses

Public

List available fine-tuning models (public)

Lists the currently available fine-tuning models without requiring authentication.

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "object": "list",
  • "data": [
    ]
}