> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modelslab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop Training

> Stop a queued or running training run and end its hourly billing.

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 a `POST` request to the endpoint below with the training `id` from [Start Training](https://docs.modelslab.com/image-generation/train-model/start-training.md).

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
POST https://modelslab.com/api/v6/trainer/stop
```

### Body

```json json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
    "key": "your_api_key",
    "training_id": "9b2f6c1e-4d3a-4f8e-a1b2-3c4d5e6f7a8b"
}
```

## Response

```json json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
    "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. |

> [!NOTE]
>
> A stopped run reads `training_completed` on the [status endpoint](https://docs.modelslab.com/image-generation/train-model/training-status.md).


## OpenAPI

````yaml image-generation/train-model/openapi.json POST /stop
openapi: 3.1.0
info:
  title: ModelsLab Train Model API
  description: >-
    Train your own LoRA on Flux, FLUX.2 Klein 9B, FLUX.3 Klein, Z-Image Turbo,
    Stable Diffusion (SDXL / SD 1.5) and MOSS Image, then check its progress or
    stop it.
  license:
    name: MIT
  version: 6.0.0
servers:
  - url: https://modelslab.com/api/v6/trainer
    description: LoRA training endpoints
security: []
paths:
  /stop:
    post:
      summary: Stop Training
      description: Stops a queued or running training run and ends its hourly billing.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StopRequest'
      responses:
        '200':
          description: The run was stopped, or an error describing why it could not be.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/StopSuccessResponse'
                  - $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/StandardErrorResponse'
components:
  schemas:
    StopRequest:
      type: object
      required:
        - key
        - training_id
      properties:
        key:
          $ref: '#/components/schemas/Key'
        training_id:
          type: string
          format: uuid
          description: The `id` returned by the Start Training endpoint.
    StopSuccessResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
        message:
          type: string
          examples:
            - training stopped
    ErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
    Key:
      type: string
      description: Your API key. Get one from https://modelslab.com/dashboard/api-keys.
  responses:
    StandardErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.