AWS AI Services

AWS AI Services span both generative and traditional AI: Amazon Bedrock (foundation model hosting and inference), Comprehend (NLP), Rekognition (Vision), Polly (Text-to-Speech), Transcribe (Speech-to-Text), Translate (MT), and Lex (Conversational AI). This file uses Amazon Polly’s HTTP endpoint (/v1/speech) as a concrete example; see links for other services.

基础 URL
https://polly.us-east-1.amazonaws.com
认证
Bearer / Authorization: Bearer
官方 SDK
Python (boto3), JavaScript/TypeScript, Java, .NET, Go, Kotlin
🔑 API Key 获取
前置要求:Requires an active AWS account with billing; choose the correct regional endpoints; enable MFA; Bedrock models require enabling access in the console before use.
入口:https://console.aws.amazon.com/iamv2/home#/security_credentials
说明:Create an IAM user or use roles in the AWS Console, attach service permissions (e.g., AmazonPollyFullAccess), then create access keys under Security Credentials; for Bedrock, enable model access in the console.

支持模型

API 接口列表

POST /v1/speech Docs

Amazon Polly Text-to-Speech endpoint. Submit JSON (Text/VoiceId/OutputFormat, etc.) to receive an audio byte stream. See SynthesizeSpeech docs.

认证Yes
频率限制60/min
计费模式按字符计费:标准语音约每百万字符$4、神经语音约每百万字符$16(随区域与语音引擎变化)。
{
  "OutputFormat": "mp3",
  "VoiceId": "Joanna",
  "Text": "Hello from AWS Polly",
  "Engine": "standard"
}
POST /model/{modelId}/invoke Docs

Amazon Bedrock Runtime InvokeModel endpoint. Send a JSON inference request to a specific model and receive generated output (text, image, or embeddings). Parameters vary by model.

认证Yes
频率限制60/min
计费模式按模型/吞吐定价(常见为按输入/输出 token 或秒计费,具体见 Bedrock 定价与模型页面)。
{
  "modelId": "anthropic.claude-3-haiku-20240307-v1:0",
  "contentType": "application/json",
  "accept": "application/json",
  "body": {
    "prompt": "Write a haiku about AWS.",
    "max_tokens_to_sample": 256
  }
}
POST /model/{modelId}/invoke-with-response-stream Docs

Amazon Bedrock Runtime InvokeModelWithResponseStream (streaming) endpoint. For long text or incremental consumption use cases; returns a chunked event stream.

认证Yes
频率限制60/min
计费模式同 InvokeModel,按模型与吞吐计费;流式不改变计费单位但影响实际调用时长。
{
  "modelId": "anthropic.claude-3-haiku-20240307-v1:0",
  "contentType": "application/json",
  "accept": "application/json",
  "body": {
    "prompt": "Explain Bedrock streaming in one paragraph.",
    "max_tokens_to_sample": 512
  }
}