More useful metadata from the model API

The “get a model” API operation now returns more metadata about the model:

  • run_count: an integer indicating how many times the model has been run.
  • default_example: a prediction object created with this model, and selected by the model owner as an example of the model’s inputs and outputs.
  • cover_image_url: an HTTPS URL string for an image file. This is an image uploaded by the model author, or an output file or input file from the model’s default example prediction.

Here’s an example using cURL and jq to get the Salesforce blip-2 model as a JSON object and pluck out some of its properties:

curl -s \
  -H "Authorization: Token $REPLICATE_API_TOKEN" \
  -H 'Content-Type: application/json' \
  "https://api.replicate.com/v1/models/salesforce/blip-2" \
  | jq "{owner, name, run_count, cover_image_url, default_example}"

Here’s what the response looks like:

{
  "owner": "salesforce",
  "name": "blip-2",
  "run_count": 270306,
  "cover_image_url": "https://replicate.delivery/pbxt/IJEPmgAlL2zNBNDoRRKFegTEcxnlRhoQxlNjPHSZEy0pSIKn/gg_bridge.jpeg",
  "default_example": {
    "completed_at": "2023-02-13T22:26:49.396028Z",
    "created_at": "2023-02-13T22:26:48.385476Z",
    "error": null,
    "id": "uhd4lhedtvdlbnm2cyhzx65zpe",
    "input": {
      "image": "https://replicate.delivery/pbxt/IJEPmgAlL2zNBNDoRRKFegTEcxnlRhoQxlNjPHSZEy0pSIKn/gg_bridge.jpeg",
      "caption": false,
      "question": "what body of water does this bridge cross?",
      "temperature": 1
    },
    "logs": "...",
    "metrics": {
      "predict_time": 0.949567
    },
    "output": "san francisco bay",
    "started_at": "2023-02-13T22:26:48.446461Z",
    "status": "succeeded",
    "version": "4b32258c42e9efd4288bb9910bc532a69727f9acd26aa08e175713a0a857a608",
  }
}

See the “get a model” API docs for more details.