bedrocksig

package
v2.37.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bedrocksig holds the shared AWS SigV4 signing and Bedrock Mantle routing helpers used by both the anthropic-go and openai-go interceptors. It depends only on stdlib and the AWS SDK so it can be imported from either SDK-specific interceptor package without pulling in the other SDK.

Index

Constants

View Source
const PRMUserAgent = "sdk-ua-app-id/APN_1.1%2Fpc_cdfmjwn8i6u8l9fwz8h82e4w3%24"

PRMUserAgent is Coder's AWS Partner Revenue Measurement (PRM) attribution marker for outbound Bedrock requests. It is appended to the User-Agent header so AWS can recognize the traffic as Coder-associated Bedrock usage.

View Source
const SigningService = "bedrock-mantle"

SigningService is the AWS SigV4 service name for Bedrock Mantle.

Variables

This section is empty.

Functions

func AppendPRMUserAgent

func AppendPRMUserAgent(req *http.Request)

AppendPRMUserAgent appends the Coder PRM attribution marker to the request's User-Agent header.

func BaseURLForModel

func BaseURLForModel(rawBase, model string) (string, error)

BaseURLForModel resolves the upstream Mantle base URL for a given model. It parses rawBase, trims any existing vendor path segment, then re-appends the one the model requires: "anthropic." models use /anthropic, "openai." models use /openai/v1, and anything else (third-party) uses /v1 so the SDK's /chat/completions route hits the root /v1/chat/completions endpoint.

func SignMiddleware

func SignMiddleware(creds aws.CredentialsProvider, region string) func(req *http.Request, next func(*http.Request) (*http.Response, error)) (*http.Response, error)

SignMiddleware returns an stdlib HTTP middleware that SigV4-signs the request for the Bedrock Mantle service. It appends the PRM user-agent, reads and restores the body for hashing, then signs with the given credentials and region. Callers wrap it in their SDK-specific option.WithMiddleware adapter.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL