Cloud
Amazon Bedrock
Every model AWS hosts, through one signed API.
Quick start
import polygate response = polygate.chat( provider="bedrock", model="anthropic.claude-3-5-sonnet-20241022-v2:0", messages=[{"role": "user", "content": "Say hi in one word."}],) print(response.content) # "Hi!"print(response.usage) # Usage(prompt_tokens=..., completion_tokens=...)Names
Any of these work as provider. They all reach the same adapter, so pick whichever reads best in your code.
bedrockawsConfiguration
| Variable | Holds |
|---|---|
| AWS_ACCESS_KEY_ID | your API key |
| AWS_SECRET_ACCESS_KEY | the other half of the credential pair |
| AWS_SESSION_TOKEN | only for temporary credentials from an assumed role |
| AWS_REGION | part of the hostname; defaults to us-east-1 |
Any of these may hold a comma-separated list. polygate rotates across them, parks a rate-limited one for its Retry-After, and drops one the provider rejects — so a key pool is configuration, not code.
Models
Examples that work today. Model names change; the provider's own list is the authority.
anthropic.claude-3-5-sonnet-20241022-v2:0us.anthropic.claude-sonnet-4-20250514-v1:0amazon.nova-pro-v1:0meta.llama3-3-70b-instruct-v1:0Things worth knowing
- polygate uses Bedrock's Converse API, not
InvokeModel. Converse is AWS's own unified interface, so one message shape works across every model they host —InvokeModelwould need a different request body per vendor, reintroducing the exact problem polygate exists to remove. - Requests are signed with SigV4, implemented in about 60 lines of standard library rather than by depending on boto3. The signature is diffed against botocore in the test suite, and the TypeScript signer is pinned to the same outputs.
- Credentials can also be passed as a single packed string,
ACCESS_KEY:SECRETorACCESS_KEY:SECRET:SESSION_TOKEN. A list of those rotates exactly like a list of OpenAI keys. - Model ids are Bedrock's own, not the vendor's. A
us.prefix means a cross-region inference profile.
Choosing a region
import polygate response = polygate.chat( provider="bedrock", model="anthropic.claude-3-5-sonnet-20241022-v2:0", messages=[{"role": "user", "content": "Hello"}], region="eu-west-1", # or $AWS_REGION)Batch
Amazon Bedrock has no offline batch API. To run many requests at once, use map_chat — full price, but it works everywhere and returns in seconds. See Batching & concurrency.
Something wrong or missing here? Open an issue.