Stop Training
curl --request POST \
--url https://modelslab.com/api/v6/trainer/stop \
--header 'Content-Type: application/json' \
--data '
{
"key": "<string>",
"training_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://modelslab.com/api/v6/trainer/stop"
payload = {
"key": "<string>",
"training_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({key: '<string>', training_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://modelslab.com/api/v6/trainer/stop', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://modelslab.com/api/v6/trainer/stop",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'key' => '<string>',
'training_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://modelslab.com/api/v6/trainer/stop"
payload := strings.NewReader("{\n \"key\": \"<string>\",\n \"training_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://modelslab.com/api/v6/trainer/stop")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"<string>\",\n \"training_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://modelslab.com/api/v6/trainer/stop")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"<string>\",\n \"training_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "training stopped"
}{
"status": "error",
"message": "<string>"
}Stop Training
Stop a queued or running training run and end its hourly billing.
POST
/
stop
Stop Training
curl --request POST \
--url https://modelslab.com/api/v6/trainer/stop \
--header 'Content-Type: application/json' \
--data '
{
"key": "<string>",
"training_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://modelslab.com/api/v6/trainer/stop"
payload = {
"key": "<string>",
"training_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({key: '<string>', training_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://modelslab.com/api/v6/trainer/stop', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://modelslab.com/api/v6/trainer/stop",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'key' => '<string>',
'training_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://modelslab.com/api/v6/trainer/stop"
payload := strings.NewReader("{\n \"key\": \"<string>\",\n \"training_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://modelslab.com/api/v6/trainer/stop")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"<string>\",\n \"training_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://modelslab.com/api/v6/trainer/stop")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"<string>\",\n \"training_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "training stopped"
}{
"status": "error",
"message": "<string>"
}Stops a run that is queued or training. Billing ends straight away; if the current hour had not been charged yet, that hour is charged. A run that has already finished or failed cannot be stopped and keeps its result.
Request
Make aPOST request to the endpoint below with the training id from Start Training.
POST https://modelslab.com/api/v6/trainer/stop
Body
json
{
"key": "your_api_key",
"training_id": "9b2f6c1e-4d3a-4f8e-a1b2-3c4d5e6f7a8b"
}
Response
json
{
"status": "success",
"message": "training stopped"
}
| Error message | Meaning |
|---|---|
Training request not found. | No run with this id belongs to your account. |
Training has already finished. | The run completed or failed before you stopped it. |
A stopped run reads
training_completed on the status endpoint.Body
application/json
Your API key. Get one from https://modelslab.com/dashboard/api-keys.
Was this page helpful?

