import type { NullableHeaders } from "./internal/headers.mjs"; import { Anthropic, ClientOptions } from '@anthropic-ai/sdk/client'; export { BaseAnthropic } from '@anthropic-ai/sdk/client'; import { AwsCredentialIdentityProvider } from '@smithy/types'; import type { Middleware } from "./core/middleware.mjs"; import { FinalRequestOptions } from "./internal/request-options.mjs"; export interface AwsClientOptions extends ClientOptions { /** * AWS region for the API gateway. * * Resolved by precedence: `awsRegion` arg > `AWS_REGION` env var > * `AWS_DEFAULT_REGION` env var > region from the AWS shared config file * (`~/.aws/config`) for the given `awsProfile` (or `[default]`). * * When resolution falls through to the config file, the region is loaded * asynchronously. It will be available after `await client.ready` or the * first request; until then `awsRegion` and `baseURL` are `undefined`. */ awsRegion?: string | undefined; /** * API key for x-api-key authentication. * * Takes precedence over AWS credential options. If neither `apiKey` nor * AWS credentials are provided, falls back to the `ANTHROPIC_AWS_API_KEY` * environment variable, then to the default AWS credential chain. */ apiKey?: string | undefined; /** * AWS access key ID for SigV4 authentication. * * Must be provided together with `awsSecretAccessKey`. */ awsAccessKey?: string | null | undefined; /** * AWS secret access key for SigV4 authentication. * * Must be provided together with `awsAccessKey`. */ awsSecretAccessKey?: string | null | undefined; /** * AWS session token for temporary credentials. */ awsSessionToken?: string | null | undefined; /** * AWS named profile for credential and region resolution. * * When set, credentials are loaded from the AWS credential chain using this * profile, and the profile's `region` from `~/.aws/config` is used as a * fallback when no region is provided via arg or environment variable. */ awsProfile?: string | undefined; /** * Custom provider chain resolver for AWS credentials. * Useful for non-Node environments, like edge workers, where the default * credential provider chain may not work. */ providerChainResolver?: (() => Promise) | null; /** * Workspace ID sent on every request as the `anthropic-workspace-id` header. * * Resolved by precedence: `workspaceId` arg > `ANTHROPIC_AWS_WORKSPACE_ID` env var. */ workspaceId?: string | undefined; /** * Skip authentication for requests. This is useful when you have a gateway * or proxy that handles authentication on your behalf. * * @default false */ skipAuth?: boolean; } /** API Client for interfacing with the Anthropic AWS API. */ export declare class AnthropicAws extends Anthropic { #private; awsRegion: string | undefined; awsAccessKey: string | null; awsSecretAccessKey: string | null; awsSessionToken: string | null; awsProfile: string | null; providerChainResolver: (() => Promise) | null; workspaceId: string | undefined; skipAuth: boolean; /** * Resolves once the client is fully configured (region and base URL * resolved). Rejects if region resolution fails. Await this to fail fast on * misconfiguration instead of waiting for the first request. */ readonly ready: Promise; private _useSigV4; /** * API Client for interfacing with the Anthropic AWS API. * * Auth is resolved by precedence: `apiKey` constructor arg > explicit AWS * credentials > `awsProfile` > `ANTHROPIC_AWS_API_KEY` env var > default * AWS credential chain. * * @param {string | undefined} [opts.apiKey] - API key for x-api-key authentication. * @param {string | null | undefined} [opts.awsAccessKey] - AWS access key ID for SigV4 authentication. * @param {string | null | undefined} [opts.awsSecretAccessKey] - AWS secret access key for SigV4 authentication. * @param {string | null | undefined} [opts.awsSessionToken] - AWS session token for temporary credentials. * @param {string | undefined} [opts.awsProfile] - AWS named profile for credential and region resolution. * @param {string | undefined} [opts.awsRegion] - AWS region. Resolved by precedence: arg > `AWS_REGION` env > `AWS_DEFAULT_REGION` env > `~/.aws/config`. * @param {(() => Promise) | null} [opts.providerChainResolver] - Custom provider chain resolver for AWS credentials. * @param {string | undefined} [opts.workspaceId] - Workspace ID sent as `anthropic-workspace-id` header. Resolved by precedence: arg > `ANTHROPIC_AWS_WORKSPACE_ID` env var. * @param {string} [opts.baseURL=process.env['ANTHROPIC_AWS_BASE_URL'] ?? https://aws-external-anthropic.{awsRegion}.api.aws] - Override the default base URL for the API. * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. * @param {boolean} [opts.skipAuth=false] - Skip authentication for requests. This is useful when you have a gateway or proxy that handles authentication on your behalf. */ constructor({ awsRegion, baseURL, apiKey, awsAccessKey, awsSecretAccessKey, awsSessionToken, awsProfile, providerChainResolver, workspaceId, skipAuth, ...opts }?: AwsClientOptions); private _resolveRegionFromConfig; protected prepareOptions(options: FinalRequestOptions): Promise; protected authHeaders(opts: FinalRequestOptions): Promise; protected validateHeaders(): void; protected backendMiddleware(): ReadonlyArray; } //# sourceMappingURL=client.d.mts.map