Amazon Bedrock
AmazonBedrockProvider in the Vercel.AI.AmazonBedrock namespace creates the Amazon Bedrock models that this port implements. The API reference lists every option: AmazonBedrockProvider.
Browse the upstream catalog of Amazon Bedrock models and their pricing on the Vercel AI Gateway models page.
Models
Section titled “Models”| Kind | Factory method | Model ids in this port’s tests and docs |
|---|---|---|
| Language | Chat, LanguageModel |
openai.gpt-oss-20b, anthropic.claude-3-haiku-20240307-v1:0 |
| Embedding | EmbeddingModel |
amazon.nova-2-multimodal-embeddings-v1:0, amazon.titan-embed-text-v2:0, amazon.titan-embed-text-v1 |
| Image | Image |
amazon.titan-image-generator, amazon.nova-canvas-v1:0 |
| Reranking | RerankingModel |
cohere.rerank-v3-5:0, amazon.rerank-v1:0 |
A model id in the table is one that the tests or docs use. It is not the complete list of ids the provider accepts. Pass any id that the provider documents.
Example
Section titled “Example”Language model:
var model = AmazonBedrockProvider.Create().LanguageModel("openai.gpt-oss-20b");var result = await Ai.GenerateTextAsync( new GenerateTextOptions { Model = model, Prompt = "Invent a new holiday and describe its traditions.", });
Console.WriteLine(result.Text);See the Providers guide for authentication and provider options.
Provider options
Section titled “Provider options”Pass these under the amazon-bedrock provider options key.
structuredOutputModeisoutputFormat,jsonTool, orauto(the default). Any other value, or a value that is not a string, throwsArgumentExceptionbefore the request is sent.serviceTierisreserved,priority,default, orflex. Any other value throwsArgumentException.requestMetadatais an object whose values are all strings.
Amazon Ergo
Section titled “Amazon Ergo”Call Amazon Ergo with an inference profile id such as us.amazon.ergo-1.0 or global.amazon.ergo-1.0. The model always reasons, so Reasoning = "none" or "minimal" is sent as low effort with a warning. Set the effort (low, medium, high, xhigh, or max) with Reasoning or reasoningConfig.maxReasoningEffort. It is sent as a nested reasoning.effort. For a readable reasoning summary, set additionalModelRequestFields to { "reasoning": { "summary": "auto" } }. The model accepts text input only and rejects Temperature, TopP, and StopSequences on Converse, so the provider removes them with a warning. When you set MaxOutputTokens, AWS recommends at least 8192, because reasoning uses part of the limit.
Cache points
Section titled “Cache points”AmazonBedrockApiTypes.CreateAmazonBedrockCachePoint(ttl) is the C# name of upstream createAmazonBedrockCachePoint. It returns the complete { "cachePoint": { "type": "default", "ttl": ... } } block. The ttl is 5m or 1h. When it is null, the ttl field is left out and Bedrock uses its default of five minutes. Pass the cachePoint value of the block, not the block itself, as the cachePoint provider option.
Authentication
Section titled “Authentication”AmazonBedrockOptions signs requests with SigV4 unless an API key is set.
ApiKey(or theAWS_BEARER_TOKEN_BEDROCKenvironment variable) sends a bearer token and takes precedence over SigV4.AccessKeyId,SecretAccessKeyandSessionTokenfall back to theAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandAWS_SESSION_TOKENenvironment variables. When bothAccessKeyIdandSecretAccessKeyare set in the options, onlySessionTokenfrom the options is used, andAWS_SESSION_TOKENis ignored.CredentialProvideris the C# name of upstreamcredentialProvider. It resolves the keys before each request, and its keys replace the three static settings. The region still comes fromRegion. A failure is reported asAWS credential provider failed: ....
Citations
Section titled “Citations”Set citations.enabled to true under the amazonBedrock (or bedrock) provider options of a document file part to turn on citations for that document. The document block then carries citations: { enabled: true }. A top-level-only media type such as image, video or application takes its subtype from the file bytes. When the bytes do not identify it, the call throws UnsupportedFunctionalityException.
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product