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.
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
custom_llm_provider | query | enum: "openai", "azure" or null | No | |
target_model_names | query | string or null | No | Comma separated list of model names to filter by. Example: 'gpt-4o,gpt-4o-mini' |
after | query | string or null | No | |
limit | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/fine_tuning/jobs" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of fine-tuning jobs, newest first. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | No | Object |
data | array of object | Yes | Data |
has_more | boolean | Yes | Has 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):
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The base model to fine-tune |
training_file | string | Yes | The id of an uploaded JSONL file with the training examples |
hyperparameters | Hyperparameters or null | No | Epochs, batch size and learning rate multiplier, auto by default |
suffix | string or null | No | Up to 18 characters added to the fine-tuned model's name |
validation_file | string or null | No | The id of an uploaded JSONL file to validate on |
integrations | array of string or null | No | Integrations to turn on for the job |
seed | integer or null | No | A seed that makes the job reproducible |
custom_llm_provider | enum: "openai", "azure", "vertex_ai" or null | No | Custom 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:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
custom_llm_provider | query | enum: "openai", "azure" or null | No | |
target_model_names | query | string or null | No | Comma separated list of model names to filter by. Example: 'gpt-4o,gpt-4o-mini' |
after | query | string or null | No | |
limit | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/v1/fine_tuning/jobs" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of fine-tuning jobs, newest first. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | No | Object |
data | array of object | Yes | Data |
has_more | boolean | Yes | Has 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):
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The base model to fine-tune |
training_file | string | Yes | The id of an uploaded JSONL file with the training examples |
hyperparameters | Hyperparameters or null | No | Epochs, batch size and learning rate multiplier, auto by default |
suffix | string or null | No | Up to 18 characters added to the fine-tuned model's name |
validation_file | string or null | No | The id of an uploaded JSONL file to validate on |
integrations | array of string or null | No | Integrations to turn on for the job |
seed | integer or null | No | A seed that makes the job reproducible |
custom_llm_provider | enum: "openai", "azure", "vertex_ai" or null | No | Custom 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:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No | |
after | query | string or null | No | |
limit | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123/events" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json FineTuningJobEventList |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | No | Object |
data | array of FineTuningJobEvent | Yes | Data |
has_more | boolean | Yes | Has 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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No | |
after | query | string or null | No | |
limit | query | integer or null | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json FineTuningJobEventList |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | No | Object |
data | array of FineTuningJobEvent | Yes | Data |
has_more | boolean | Yes | Has 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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No | |
after | query | string or null | No | |
limit | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123/checkpoints" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json FineTuningJobCheckpointList |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | No | Object |
data | array of FineTuningJobCheckpoint | Yes | Data |
has_more | boolean | Yes | Has 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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No | |
after | query | string or null | No | |
limit | query | integer or null | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json FineTuningJobCheckpointList |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | No | Object |
data | array of FineTuningJobCheckpoint | Yes | Data |
has_more | boolean | Yes | Has 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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | enum: "openai", "azure" or null | No |
Example request:
curl -X GET "http://localhost:4000/fine_tuning/jobs/fine_tuning_job_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job with its current status. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | enum: "openai", "azure" or null | No |
Example request:
curl -X GET "http://localhost:4000/v1/fine_tuning/jobs/fine_tuning_job_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job with its current status. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job after it was cancelled. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job after it was cancelled. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job after it was paused. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job after it was paused. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job with its current status. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
fine_tuning_job_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | The fine-tuning job with its current status. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
created_at | integer | Yes | Created At |
error | object or null | No | |
fine_tuned_model | string or null | No | Fine Tuned Model |
finished_at | integer or null | No | Finished At |
hyperparameters | object | Yes | The hyperparameters used for the fine-tuning job. |
model | string | Yes | Model |
object | "fine_tuning.job" | Yes | Object |
organization_id | string | Yes | Organization Id |
result_files | array of string | Yes | Result Files |
seed | integer or null | No | Seed |
status | enum: "validating_files", "queued", "running", "succeeded", "failed", "cancelled", "paused" | Yes | Status |
trained_tokens | integer or null | No | Trained Tokens |
training_file | string | Yes | Training File |
validation_file | string or null | No | Validation File |
estimated_finish | integer or null | No | Estimated Finish |
integrations | array of object or null | No | Integrations |
metadata | object or null | No | Metadata |
method | object or null | No |