

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 API 提交提示並產生回應
<a name="inference-api"></a>

Amazon Bedrock 提供 followingAPI 操作來執行模型推論：
+ [InvokeModel](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html) – 提交提示並產生回應。請求內文是模型特定的。若要產生串流回應，請使用 [InvokeModelWithResponseStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModelWithResponseStream.html)。
+ [反之](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html) – 提交提示，並使用跨所有模型統一的結構產生回應。您可以在 `additionalModelRequestFields` 欄位中指定模型特定的請求欄位。您也可以針對內容包含系統提示和先前的對話。若要產生串流回應，請使用 [ConverseStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html)。
+ [StartAsyncInvoke](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_StartAsyncInvoke.html) – 提交提示並以非同步方式產生可在稍後擷取的回應。用來產生影片。
+ [InvokeModelWithBidirectionalStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModelWithBidirectionalStream.html) – 
+ OpenAI 聊天完成 API – 使用 [OpenAI 聊天完成 API](https://platform.openai.com/docs/api-reference/chat/create) 搭配 Amazon Bedrock 支援的模型來產生回應。

**注意**  
限制適用於下列操作：`InvokeModel`、`Converse`、 `InvokeModelWithResponseStream`和 `ConverseStream`。如需詳細資訊，請參閱 [API 限制](inference-api-restrictions.md)。

針對模型推論，您需要判斷下列參數：
+ 模型 ID – 要在 `modelId` 欄位中用於推論的模型或推論設定檔 ID 或 Amazon Resource Name (ARN)。下表說明如何尋找不同類型的資源 ID：  
****    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/inference-api.html)
+ 請求內文 – 包含模型和其他組態的推論參數。每個基本模型都有各自的推論參數。自訂或佈建的模型的推論參數為何，取決於建立該參數的基本模型。如需詳細資訊，請參閱[基礎模型的推論請求參數和回應欄位](model-parameters.md)。

選取主題以了解如何使用模型調用 API。

**Topics**
+ [使用 InvokeModel 提交單一提示](inference-invoke.md)
+ [使用 OpenAI 聊天完成 API 調用模型](inference-chat-completions.md)
+ [與 Converse API 操作進行對話](conversation-inference.md)
+ [API 限制](inference-api-restrictions.md)