{
  "version":"2.0",
  "metadata":{
    "apiVersion":"2023-09-30",
    "endpointPrefix":"bedrock-runtime",
    "jsonVersion":"1.1",
    "protocol":"rest-json",
    "serviceFullName":"Amazon Bedrock Runtime",
    "serviceId":"Bedrock Runtime",
    "signatureVersion":"v4",
    "signingName":"bedrock",
    "uid":"bedrock-runtime-2023-09-30"
  },
  "operations":{
    "InvokeModel":{
      "name":"InvokeModel",
      "http":{
        "method":"POST",
        "requestUri":"/model/{modelId}/invoke",
        "responseCode":200
      },
      "input":{"shape":"InvokeModelRequest"},
      "output":{"shape":"InvokeModelResponse"},
      "errors":[
        {"shape":"AccessDeniedException"},
        {"shape":"ResourceNotFoundException"},
        {"shape":"ThrottlingException"},
        {"shape":"ModelTimeoutException"},
        {"shape":"InternalServerException"},
        {"shape":"ValidationException"},
        {"shape":"ModelNotReadyException"},
        {"shape":"ServiceQuotaExceededException"},
        {"shape":"ModelErrorException"}
      ],
      "documentation":"<p>Invokes the specified Bedrock model to run inference using the input provided in the request body. You use InvokeModel to run inference for text models, image models, and embedding models.</p> <p>For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html\">Run inference</a> in the Bedrock User Guide.</p> <p>For example requests, see Examples (after the Errors section).</p>"
    },
    "InvokeModelWithResponseStream":{
      "name":"InvokeModelWithResponseStream",
      "http":{
        "method":"POST",
        "requestUri":"/model/{modelId}/invoke-with-response-stream",
        "responseCode":200
      },
      "input":{"shape":"InvokeModelWithResponseStreamRequest"},
      "output":{"shape":"InvokeModelWithResponseStreamResponse"},
      "errors":[
        {"shape":"AccessDeniedException"},
        {"shape":"ResourceNotFoundException"},
        {"shape":"ThrottlingException"},
        {"shape":"ModelTimeoutException"},
        {"shape":"InternalServerException"},
        {"shape":"ModelStreamErrorException"},
        {"shape":"ValidationException"},
        {"shape":"ModelNotReadyException"},
        {"shape":"ServiceQuotaExceededException"},
        {"shape":"ModelErrorException"}
      ],
      "documentation":"<p>Invoke the specified Bedrock model to run inference using the input provided. Return the response in a stream.</p> <p>For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html\">Run inference</a> in the Bedrock User Guide.</p> <p>For an example request and response, see Examples (after the Errors section).</p>"
    }
  },
  "shapes":{
    "AccessDeniedException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"}
      },
      "documentation":"<p>The request is denied because of missing access permissions.</p>",
      "error":{
        "httpStatusCode":403,
        "senderFault":true
      },
      "exception":true
    },
    "Body":{
      "type":"blob",
      "max":25000000,
      "min":0,
      "sensitive":true
    },
    "InternalServerException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"}
      },
      "documentation":"<p>An internal server error occurred. Retry your request.</p>",
      "error":{"httpStatusCode":500},
      "exception":true,
      "fault":true
    },
    "InvokeModelIdentifier":{
      "type":"string",
      "max":2048,
      "min":1,
      "pattern":"^(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}/[a-z0-9]{12})|(:foundation-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.]?[a-z0-9-]{1,63}))|([0-9]{12}:provisioned-model/[a-z0-9]{12})))|([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.]?[a-z0-9-]{1,63}))|(([0-9a-zA-Z][_-]?)+)$"
    },
    "InvokeModelRequest":{
      "type":"structure",
      "required":[
        "body",
        "modelId"
      ],
      "members":{
        "accept":{
          "shape":"MimeType",
          "documentation":"<p>The desired MIME type of the inference body in the response. The default value is <code>application/json</code>.</p>",
          "location":"header",
          "locationName":"Accept"
        },
        "body":{
          "shape":"Body",
          "documentation":"<p>Input data in the format specified in the content-type request header. To see the format and content of this field for different models, refer to <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html\">Inference parameters</a>.</p>"
        },
        "contentType":{
          "shape":"MimeType",
          "documentation":"<p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p>",
          "location":"header",
          "locationName":"Content-Type"
        },
        "modelId":{
          "shape":"InvokeModelIdentifier",
          "documentation":"<p>Identifier of the model. </p>",
          "location":"uri",
          "locationName":"modelId"
        }
      },
      "payload":"body"
    },
    "InvokeModelResponse":{
      "type":"structure",
      "required":[
        "body",
        "contentType"
      ],
      "members":{
        "body":{
          "shape":"Body",
          "documentation":"<p>Inference response from the model in the format specified in the content-type header field. To see the format and content of this field for different models, refer to <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html\">Inference parameters</a>.</p>"
        },
        "contentType":{
          "shape":"MimeType",
          "documentation":"<p>The MIME type of the inference result.</p>",
          "location":"header",
          "locationName":"Content-Type"
        }
      },
      "payload":"body"
    },
    "InvokeModelWithResponseStreamRequest":{
      "type":"structure",
      "required":[
        "body",
        "modelId"
      ],
      "members":{
        "accept":{
          "shape":"MimeType",
          "documentation":"<p>The desired MIME type of the inference body in the response. The default value is <code>application/json</code>.</p>",
          "location":"header",
          "locationName":"X-Amzn-Bedrock-Accept"
        },
        "body":{
          "shape":"Body",
          "documentation":"<p>Inference input in the format specified by the content-type. To see the format and content of this field for different models, refer to <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html\">Inference parameters</a>.</p>"
        },
        "contentType":{
          "shape":"MimeType",
          "documentation":"<p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p>",
          "location":"header",
          "locationName":"Content-Type"
        },
        "modelId":{
          "shape":"InvokeModelIdentifier",
          "documentation":"<p>Id of the model to invoke using the streaming request.</p>",
          "location":"uri",
          "locationName":"modelId"
        }
      },
      "payload":"body"
    },
    "InvokeModelWithResponseStreamResponse":{
      "type":"structure",
      "required":[
        "body",
        "contentType"
      ],
      "members":{
        "body":{
          "shape":"ResponseStream",
          "documentation":"<p>Inference response from the model in the format specified by Content-Type. To see the format and content of this field for different models, refer to <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html\">Inference parameters</a>.</p>"
        },
        "contentType":{
          "shape":"MimeType",
          "documentation":"<p>The MIME type of the inference result.</p>",
          "location":"header",
          "locationName":"X-Amzn-Bedrock-Content-Type"
        }
      },
      "payload":"body"
    },
    "MimeType":{"type":"string"},
    "ModelErrorException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"},
        "originalStatusCode":{
          "shape":"StatusCode",
          "documentation":"<p>The original status code.</p>"
        },
        "resourceName":{
          "shape":"NonBlankString",
          "documentation":"<p>The resource name.</p>"
        }
      },
      "documentation":"<p>The request failed due to an error while processing the model.</p>",
      "error":{
        "httpStatusCode":424,
        "senderFault":true
      },
      "exception":true
    },
    "ModelNotReadyException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"}
      },
      "documentation":"<p>The model specified in the request is not ready to serve inference requests.</p>",
      "error":{
        "httpStatusCode":429,
        "senderFault":true
      },
      "exception":true
    },
    "ModelStreamErrorException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"},
        "originalMessage":{
          "shape":"NonBlankString",
          "documentation":"<p>The original message.</p>"
        },
        "originalStatusCode":{
          "shape":"StatusCode",
          "documentation":"<p>The original status code.</p>"
        }
      },
      "documentation":"<p>An error occurred while streaming the response.</p>",
      "error":{
        "httpStatusCode":424,
        "senderFault":true
      },
      "exception":true
    },
    "ModelTimeoutException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"}
      },
      "documentation":"<p>The request took too long to process. Processing time exceeded the model timeout length.</p>",
      "error":{
        "httpStatusCode":408,
        "senderFault":true
      },
      "exception":true
    },
    "NonBlankString":{
      "type":"string",
      "pattern":"^[\\s\\S]*$"
    },
    "PartBody":{
      "type":"blob",
      "max":1000000,
      "min":0,
      "sensitive":true
    },
    "PayloadPart":{
      "type":"structure",
      "members":{
        "bytes":{
          "shape":"PartBody",
          "documentation":"<p>Base64-encoded bytes of payload data.</p>"
        }
      },
      "documentation":"<p>Payload content included in the response.</p>",
      "event":true,
      "sensitive":true
    },
    "ResourceNotFoundException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"}
      },
      "documentation":"<p>The specified resource ARN was not found. Check the ARN and try your request again.</p>",
      "error":{
        "httpStatusCode":404,
        "senderFault":true
      },
      "exception":true
    },
    "ResponseStream":{
      "type":"structure",
      "members":{
        "chunk":{
          "shape":"PayloadPart",
          "documentation":"<p>Content included in the response.</p>"
        },
        "internalServerException":{"shape":"InternalServerException"},
        "modelStreamErrorException":{"shape":"ModelStreamErrorException"},
        "modelTimeoutException":{"shape":"ModelTimeoutException"},
        "throttlingException":{"shape":"ThrottlingException"},
        "validationException":{"shape":"ValidationException"}
      },
      "documentation":"<p>Definition of content in the response stream.</p>",
      "eventstream":true
    },
    "ServiceQuotaExceededException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"}
      },
      "documentation":"<p>The number of requests exceeds the service quota. Resubmit your request later.</p>",
      "error":{
        "httpStatusCode":400,
        "senderFault":true
      },
      "exception":true
    },
    "StatusCode":{
      "type":"integer",
      "box":true,
      "max":599,
      "min":100
    },
    "ThrottlingException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"}
      },
      "documentation":"<p>The number of requests exceeds the limit. Resubmit your request later.</p>",
      "error":{
        "httpStatusCode":429,
        "senderFault":true
      },
      "exception":true
    },
    "ValidationException":{
      "type":"structure",
      "members":{
        "message":{"shape":"NonBlankString"}
      },
      "documentation":"<p>Input validation failed. Check your request parameters and retry the request.</p>",
      "error":{
        "httpStatusCode":400,
        "senderFault":true
      },
      "exception":true
    }
  },
  "documentation":"<p>Describes the API operations for running inference using Bedrock models.</p>"
}
