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

      Get a prediction

      GET
      /v1/predictions/{prediction_id}
      Get the current state of a prediction.
      Example cURL request:
      curl -s \
        -H "Authorization: Token <paste-your-token-here>" \
        https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu
      The response will be the prediction object:
      {
        "id": "gm3qorzdhgbfurvjtvhg6dckhu",
        "model": "replicate/hello-world",
        "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
        "input": {
          "text": "Alice"
        },
        "logs": "",
        "output": "hello Alice",
        "error": null,
        "status": "succeeded",
        "created_at": "2023-09-08T16:19:34.765994Z",
        "started_at": "2023-09-08T16:19:34.779176Z",
        "completed_at": "2023-09-08T16:19:34.791859Z",
        "metrics": {
          "predict_time": 0.012683
        },
        "urls": {
          "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
          "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
        }
      }
      status will be one of:
      starting: the prediction is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the prediction.
      processing: the predict() method of the model is currently running.
      succeeded: the prediction completed successfully.
      failed: the prediction encountered an error during processing.
      canceled: the prediction was canceled by its creator.
      In the case of success, output will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the Authorization header to request them.
      In the case of failure, error will contain the error encountered during the prediction.
      Terminated predictions (with a status of succeeded, failed, or canceled) will include a metrics object with a predict_time property showing the amount of CPU or GPU time, in seconds, that the prediction used while running. It won't include time waiting for the prediction to start.
      Input and output (including any files) are automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.
      Output files are served by replicate.delivery and its subdomains. If you use an allow list of external domains for your assets, add replicate.delivery and *.replicate.delivery to it.
      Request Request Example
      Shell
      JavaScript
      Java
      Swift
      curl --location --request GET 'https://api.replicate.com/v1/predictions/'
      Response Response Example
      {}

      Request

      Authorization
      Provide your bearer token in the
      Authorization
      header when making requests to protected resources.
      Example:
      Authorization: Bearer ********************
      Path Params
      prediction_id
      string 
      required
      The ID of the prediction to get.

      Responses

      🟢200Success
      application/json
      Body
      object {0}
      Modified at 2023-12-22 03:33:22
      Previous
      Create a prediction
      Next
      Cancel a prediction
      Built with