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 prediction

      POST
      /v1/predictions
      Start a new prediction for the model version and inputs you provide.
      Example request body:
      {
        "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
        "input": {
          "text": "Alice"
        }
      }
      Example cURL request:
      curl -s -X POST \
        -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \
        -H "Authorization: Token <paste-your-token-here>" \
        -H 'Content-Type: application/json' \
        https://api.replicate.com/v1/predictions
      The response will be the prediction object:
      {
        "id": "gm3qorzdhgbfurvjtvhg6dckhu",
        "model": "replicate/hello-world",
        "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
        "input": {
          "text": "Alice"
        },
        "logs": "",
        "error": null,
        "status": "starting",
        "created_at": "2023-09-08T16:19:34.765994657Z",
        "urls": {
          "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",
          "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"
        }
      }
      As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a webhook HTTPS URL for us to call when the results are ready, or poll the get a prediction endpoint until it has finished.
      Input and output (including any files) will be 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 POST 'https://api.replicate.com/v1/predictions' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "input": {},
          "stream": true,
          "version": "string",
          "webhook": "string",
          "webhook_events_filter": [
              "start"
          ]
      }'
      Response Response Example
      {}

      Request

      Authorization
      Provide your bearer token in the
      Authorization
      header when making requests to protected resources.
      Example:
      Authorization: Bearer ********************
      Body Params application/json

      Examples

      Responses

      🟢200Success
      application/json
      Body

      Modified at 2023-12-22 03:33:22
      Previous
      List predictions
      Next
      Get a prediction
      Built with