Skip to main content

Fine-tuning API

This page documents the 16 gateway endpoints tagged fine-tuning in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.

MethodPathSummary
GET/fine_tuning/jobsList fine-tuning jobs
POST/fine_tuning/jobsCreate a fine-tuning job
GET/v1/fine_tuning/jobsList fine-tuning jobs
POST/v1/fine_tuning/jobsCreate a fine-tuning job
GET/fine_tuning/jobs/{fine_tuning_job_id}/eventsList a fine-tuning job's events
GET/v1/fine_tuning/jobs/{fine_tuning_job_id}/eventsList a fine-tuning job's events
GET/fine_tuning/jobs/{fine_tuning_job_id}/checkpointsList a fine-tuning job's checkpoints
GET/v1/fine_tuning/jobs/{fine_tuning_job_id}/checkpointsList a fine-tuning job's checkpoints
GET/fine_tuning/jobs/{fine_tuning_job_id}Retrieve a fine-tuning job
GET/v1/fine_tuning/jobs/{fine_tuning_job_id}Retrieve a fine-tuning job
POST/fine_tuning/jobs/{fine_tuning_job_id}/cancelCancel a fine-tuning job
POST/v1/fine_tuning/jobs/{fine_tuning_job_id}/cancelCancel a fine-tuning job
POST/fine_tuning/jobs/{fine_tuning_job_id}/pausePause a fine-tuning job
POST/v1/fine_tuning/jobs/{fine_tuning_job_id}/pausePause a fine-tuning job
POST/fine_tuning/jobs/{fine_tuning_job_id}/resumeResume a fine-tuning job
POST/v1/fine_tuning/jobs/{fine_tuning_job_id}/resumeResume a fine-tuning job

Endpoints​

GET /fine_tuning/jobs​

List fine-tuning jobs

Lists fine-tuning jobs newest first. Pass custom_llm_provider (openai or azure) to list the provider account's jobs, or target_model_names with exactly one model name to list the jobs of that model's credentials. after is the id of the last job on the previous page and limit the page size, 20 by default. It needs an Enterprise license, any authenticated key may call it, and nothing changes.

Parameters:

NameInTypeRequiredDescription
custom_llm_providerqueryenum: "openai", "azure" or nullNo
target_model_namesquerystring or nullNoComma separated list of model names to filter by. Example: 'gpt-4o,gpt-4o-mini'
afterquerystring or nullNo
limitqueryinteger or nullNo

Example request:

curl -X GET "http://localhost:4000/fine_tuning/jobs" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of fine-tuning jobs, newest first.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
object"list"NoObject
dataarray of objectYesData
has_morebooleanYesHas More

POST /fine_tuning/jobs​

Create a fine-tuning job

Starts training a custom version of a model on an uploaded file of example conversations. The provider queues the job and the trained model appears under fine_tuned_model when the status reaches succeeded. It needs an Enterprise license, any key allowed to use the model may call it, and the provider bills the training run. The body follows the OpenAI fine-tuning API, plus custom_llm_provider (openai, azure or vertex_ai) when the training file is not a Spanway managed file.

Example Curl:

curl http://localhost:4000/v1/fine_tuning/jobs -H "Content-Type: application/json" -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -d '{
"model": "gpt-4.1-mini-2025-04-14",
"training_file": "file-abc123",
"hyperparameters": {
"n_epochs": 3
},
"custom_llm_provider": "openai"
}'

Request body (application/json, schema SpanwayFineTuningJobCreate):

FieldTypeRequiredDescription
modelstringYesThe base model to fine-tune
training_filestringYesThe id of an uploaded JSONL file with the training examples
hyperparametersHyperparameters or nullNoEpochs, batch size and learning rate multiplier, auto by default
suffixstring or nullNoUp to 18 characters added to the fine-tuned model's name
validation_filestring or nullNoThe id of an uploaded JSONL file to validate on
integrationsarray of string or nullNoIntegrations to turn on for the job
seedinteger or nullNoA seed that makes the job reproducible
custom_llm_providerenum: "openai", "azure", "vertex_ai" or nullNoCustom Llm Provider

Example request:

curl -X POST "http://localhost:4000/fine_tuning/jobs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1-mini-2025-04-14",
"training_file": "file-abc123",
"hyperparameters": {
"n_epochs": 3
},
"suffix": "support-bot",
"custom_llm_provider": "openai"
}'

Responses:

StatusDescriptionBody
200The fine-tuning job.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

GET /v1/fine_tuning/jobs​

List fine-tuning jobs

Lists fine-tuning jobs newest first. Pass custom_llm_provider (openai or azure) to list the provider account's jobs, or target_model_names with exactly one model name to list the jobs of that model's credentials. after is the id of the last job on the previous page and limit the page size, 20 by default. It needs an Enterprise license, any authenticated key may call it, and nothing changes.

Parameters:

NameInTypeRequiredDescription
custom_llm_providerqueryenum: "openai", "azure" or nullNo
target_model_namesquerystring or nullNoComma separated list of model names to filter by. Example: 'gpt-4o,gpt-4o-mini'
afterquerystring or nullNo
limitqueryinteger or nullNo

Example request:

curl -X GET "http://localhost:4000/v1/fine_tuning/jobs" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of fine-tuning jobs, newest first.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
object"list"NoObject
dataarray of objectYesData
has_morebooleanYesHas More

POST /v1/fine_tuning/jobs​

Create a fine-tuning job

Starts training a custom version of a model on an uploaded file of example conversations. The provider queues the job and the trained model appears under fine_tuned_model when the status reaches succeeded. It needs an Enterprise license, any key allowed to use the model may call it, and the provider bills the training run. The body follows the OpenAI fine-tuning API, plus custom_llm_provider (openai, azure or vertex_ai) when the training file is not a Spanway managed file.

Example Curl:

curl http://localhost:4000/v1/fine_tuning/jobs -H "Content-Type: application/json" -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -d '{
"model": "gpt-4.1-mini-2025-04-14",
"training_file": "file-abc123",
"hyperparameters": {
"n_epochs": 3
},
"custom_llm_provider": "openai"
}'

Request body (application/json, schema SpanwayFineTuningJobCreate):

FieldTypeRequiredDescription
modelstringYesThe base model to fine-tune
training_filestringYesThe id of an uploaded JSONL file with the training examples
hyperparametersHyperparameters or nullNoEpochs, batch size and learning rate multiplier, auto by default
suffixstring or nullNoUp to 18 characters added to the fine-tuned model's name
validation_filestring or nullNoThe id of an uploaded JSONL file to validate on
integrationsarray of string or nullNoIntegrations to turn on for the job
seedinteger or nullNoA seed that makes the job reproducible
custom_llm_providerenum: "openai", "azure", "vertex_ai" or nullNoCustom Llm Provider

Example request:

curl -X POST "http://localhost:4000/v1/fine_tuning/jobs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1-mini-2025-04-14",
"training_file": "file-abc123",
"hyperparameters": {
"n_epochs": 3
},
"suffix": "support-bot",
"custom_llm_provider": "openai"
}'

Responses:

StatusDescriptionBody
200The fine-tuning job.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

GET /fine_tuning/jobs/{fine_tuning_job_id}/events​

List a fine-tuning job's events

Shows the progress log of a fine-tuning job, such as queued, each training step's loss and completion, newest first. Use limit and after to page. Works for the openai and azure providers, pass custom_llm_provider or a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, a managed job id only answers for its owner, and nothing changes.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo
afterquerystring or nullNo
limitqueryinteger or nullNo

Example request:

curl -X GET "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123/events" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Successful Responseapplication/json FineTuningJobEventList
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
object"list"NoObject
dataarray of FineTuningJobEventYesData
has_morebooleanYesHas More

GET /v1/fine_tuning/jobs/{fine_tuning_job_id}/events​

List a fine-tuning job's events

Shows the progress log of a fine-tuning job, such as queued, each training step's loss and completion, newest first. Use limit and after to page. Works for the openai and azure providers, pass custom_llm_provider or a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, a managed job id only answers for its owner, and nothing changes.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo
afterquerystring or nullNo
limitqueryinteger or nullNo

Example request:

curl -X GET "http://localhost:4000/v1/fine_tuning/jobs/fine_tuning_job_id-123/events" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Successful Responseapplication/json FineTuningJobEventList
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
object"list"NoObject
dataarray of FineTuningJobEventYesData
has_morebooleanYesHas More

GET /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints​

List a fine-tuning job's checkpoints

Lists the intermediate models a fine-tuning job saved along the way, with their training and validation loss, so an operator can pick an earlier checkpoint if later steps overfit. Works for the openai and azure providers, pass custom_llm_provider or a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, a managed job id only answers for its owner, and nothing changes.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo
afterquerystring or nullNo
limitqueryinteger or nullNo

Example request:

curl -X GET "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123/checkpoints" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Successful Responseapplication/json FineTuningJobCheckpointList
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
object"list"NoObject
dataarray of FineTuningJobCheckpointYesData
has_morebooleanYesHas More

GET /v1/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints​

List a fine-tuning job's checkpoints

Lists the intermediate models a fine-tuning job saved along the way, with their training and validation loss, so an operator can pick an earlier checkpoint if later steps overfit. Works for the openai and azure providers, pass custom_llm_provider or a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, a managed job id only answers for its owner, and nothing changes.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo
afterquerystring or nullNo
limitqueryinteger or nullNo

Example request:

curl -X GET "http://localhost:4000/v1/fine_tuning/jobs/fine_tuning_job_id-123/checkpoints" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Successful Responseapplication/json FineTuningJobCheckpointList
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
object"list"NoObject
dataarray of FineTuningJobCheckpointYesData
has_morebooleanYesHas More

GET /fine_tuning/jobs/{fine_tuning_job_id}​

Retrieve a fine-tuning job

Reads one fine-tuning job: its status, hyperparameters and, once it succeeded, the name of the trained model. Pass custom_llm_provider (openai or azure) unless the id is a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, a managed job id only answers for its owner, and nothing changes.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerqueryenum: "openai", "azure" or nullNo

Example request:

curl -X GET "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The fine-tuning job with its current status.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

GET /v1/fine_tuning/jobs/{fine_tuning_job_id}​

Retrieve a fine-tuning job

Reads one fine-tuning job: its status, hyperparameters and, once it succeeded, the name of the trained model. Pass custom_llm_provider (openai or azure) unless the id is a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, a managed job id only answers for its owner, and nothing changes.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerqueryenum: "openai", "azure" or nullNo

Example request:

curl -X GET "http://localhost:4000/v1/fine_tuning/jobs/fine_tuning_job_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The fine-tuning job with its current status.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

POST /fine_tuning/jobs/{fine_tuning_job_id}/cancel​

Cancel a fine-tuning job

Stops a fine-tuning job for good. Training already done is billed by the provider and no model is produced. Send custom_llm_provider in the body or the query unless the id is a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, and a managed job id only for its owner.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo

Request body (application/json, FineTuningJobActionRequest or null):

Example request:

curl -X POST "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123/cancel" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"custom_llm_provider": "openai"
}'

Responses:

StatusDescriptionBody
200The fine-tuning job after it was cancelled.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

POST /v1/fine_tuning/jobs/{fine_tuning_job_id}/cancel​

Cancel a fine-tuning job

Stops a fine-tuning job for good. Training already done is billed by the provider and no model is produced. Send custom_llm_provider in the body or the query unless the id is a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, and a managed job id only for its owner.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo

Request body (application/json, FineTuningJobActionRequest or null):

Example request:

curl -X POST "http://localhost:4000/v1/fine_tuning/jobs/fine_tuning_job_id-123/cancel" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"custom_llm_provider": "openai"
}'

Responses:

StatusDescriptionBody
200The fine-tuning job after it was cancelled.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

POST /fine_tuning/jobs/{fine_tuning_job_id}/pause​

Pause a fine-tuning job

Pauses a running fine-tuning job so it can be resumed later from where it stopped. Works for the openai and azure providers, pass custom_llm_provider or a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, and a managed job id only for its owner.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo

Request body (application/json, FineTuningJobActionRequest or null):

Example request:

curl -X POST "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123/pause" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"custom_llm_provider": "openai"
}'

Responses:

StatusDescriptionBody
200The fine-tuning job after it was paused.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

POST /v1/fine_tuning/jobs/{fine_tuning_job_id}/pause​

Pause a fine-tuning job

Pauses a running fine-tuning job so it can be resumed later from where it stopped. Works for the openai and azure providers, pass custom_llm_provider or a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, and a managed job id only for its owner.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo

Request body (application/json, FineTuningJobActionRequest or null):

Example request:

curl -X POST "http://localhost:4000/v1/fine_tuning/jobs/fine_tuning_job_id-123/pause" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"custom_llm_provider": "openai"
}'

Responses:

StatusDescriptionBody
200The fine-tuning job after it was paused.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

POST /fine_tuning/jobs/{fine_tuning_job_id}/resume​

Resume a fine-tuning job

Restarts a paused fine-tuning job from where it stopped. Works for the openai and azure providers, pass custom_llm_provider or a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, and a managed job id only for its owner.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo

Request body (application/json, FineTuningJobActionRequest or null):

Example request:

curl -X POST "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123/resume" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"custom_llm_provider": "openai"
}'

Responses:

StatusDescriptionBody
200The fine-tuning job with its current status.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo

POST /v1/fine_tuning/jobs/{fine_tuning_job_id}/resume​

Resume a fine-tuning job

Restarts a paused fine-tuning job from where it stopped. Works for the openai and azure providers, pass custom_llm_provider or a Spanway managed job id. It needs an Enterprise license, any authenticated key may call it, and a managed job id only for its owner.

Parameters:

NameInTypeRequiredDescription
fine_tuning_job_idpathstringYes
custom_llm_providerquerystring or nullNo

Request body (application/json, FineTuningJobActionRequest or null):

Example request:

curl -X POST "http://localhost:4000/v1/fine_tuning/jobs/fine_tuning_job_id-123/resume" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"custom_llm_provider": "openai"
}'

Responses:

StatusDescriptionBody
200The fine-tuning job with its current status.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
errorobject or nullNo
fine_tuned_modelstring or nullNoFine Tuned Model
finished_atinteger or nullNoFinished At
hyperparametersobjectYesThe hyperparameters used for the fine-tuning job.
modelstringYesModel
object"fine_tuning.job"YesObject
organization_idstringYesOrganization Id
result_filesarray of stringYesResult Files
seedinteger or nullNoSeed
statusenum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused"YesStatus
trained_tokensinteger or nullNoTrained Tokens
training_filestringYesTraining File
validation_filestring or nullNoValidation File
estimated_finishinteger or nullNoEstimated Finish
integrationsarray of object or nullNoIntegrations
metadataobject or nullNoMetadata
methodobject or nullNo