Replicate API
    Replicate API
    • List collections of models
      GET
    • Get a collection of models
      GET
    • List available hardware for models
      GET
    • List public models
      GET
    • Create a model
      POST
    • Get a model
      GET
    • List model versions
      GET
    • Delete a model version
      DELETE
    • Get a model version
      GET
    • Create a training
      POST
    • List predictions
      GET
    • Create a prediction
      POST
    • Get a prediction
      GET
    • Cancel a prediction
      POST
    • List trainings
      GET
    • Get a training
      GET
    • Cancel a training
      POST

      Create a training

      POST
      /v1/models/{model_owner}/{model_name}/versions/{version_id}/trainings
      Start a new training of the model version you specify.
      Example request body:
      {
        "destination": "{new_owner}/{new_name}",
        "input": {
          "train_data": "https://example.com/my-input-images.zip",
        },
        "webhook": "https://example.com/my-webhook",
      }
      Example cURL request:
      curl -s -X POST \
        -d '{"destination": "{new_owner}/{new_name}", "input": {"input_images": "https://example.com/my-input-images.zip"}}' \
        -H "Authorization: Token <paste-your-token-here>" \
        -H 'Content-Type: application/json' \
        https://api.replicate.com/v1/models/stability-ai/sdxl/versions/da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf/trainings
      The response will be the training object:
      {
        "id": "zz4ibbonubfz7carwiefibzgga",
        "model": "stability-ai/sdxl",
        "version": "da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf",
        "input": {
          "input_images": "https://example.com/my-input-images.zip"
        },
        "logs": "",
        "error": null,
        "status": "starting",
        "created_at": "2023-09-08T16:32:56.990893084Z",
        "urls": {
          "cancel": "https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga/cancel",
          "get": "https://api.replicate.com/v1/predictions/zz4ibbonubfz7carwiefibzgga"
        }
      }
      As models can take several minutes or more to train, the result will not be available immediately. To get the final result of the training you should either provide a webhook HTTPS URL for us to call when the results are ready, or poll the get a training endpoint until it has finished.
      When a training completes, it creates a new version of the model at the specified destination.
      To find some models to train on, check out the trainable language models collection.
      Request Request Example
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'https://api.replicate.com/v1/models///versions//trainings' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "destination": "string",
          "input": {},
          "webhook": "string"
      }'
      Response Response Example
      {}

      Request

      Authorization
      Provide your bearer token in the
      Authorization
      header when making requests to protected resources.
      Example:
      Authorization: Bearer ********************
      Path Params
      model_owner
      string 
      required
      The name of the user or organization that owns the model.
      model_name
      string 
      required
      The name of the model.
      version_id
      string 
      required
      The ID of the version.
      Body Params application/json
      destination
      string 
      optional
      A string representing the desired model to push to in the format {destination_model_owner}/{destination_model_name}. This should be an existing model owned by the user or organization making the API request. If the destination is invalid, the server will return an appropriate 4XX response.
      input
      object 
      optional
      An object containing inputs to the Cog model's train() function.
      webhook
      string 
      optional
      An HTTPS URL for receiving a webhook when the training completes. The webhook will be a POST request where the request body is the same as the response body of the get training operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once.
      Examples

      Responses

      🟢201Success
      application/json
      Body
      object {0}
      Modified at 2023-12-22 03:33:22
      Previous
      Get a model version
      Next
      List predictions
      Built with