Skip to main content

Parameters

ParameterTypeDefaultDescription
api_keystr | NoneNoneThe API key to use for authentication, if not provided, the ANTHROPIC_API_KEY environment variable will be used if available.
base_urlstr | NoneNoneThe base URL to use for the Anthropic API.
anthropic_clientAsyncAnthropicClient | NoneNoneAn existing AsyncAnthropic client to use. If provided, the api_key and http_client arguments will be ignored.
http_clienthttpx.AsyncClient | NoneNoneAn existing httpx.AsyncClient to use for making HTTP requests.

Functions

__init__

Create a new Anthropic provider. Parameters:
  • api_key (str | None): The API key to use for authentication, if not provided, the ANTHROPIC_API_KEY environment variable will be used if available.
  • base_url (str | None): The base URL to use for the Anthropic API.
  • anthropic_client (AsyncAnthropicClient | None): An existing AsyncAnthropic client to use. If provided, the api_key and http_client arguments will be ignored.
  • http_client (httpx.AsyncClient | None): An existing httpx.AsyncClient to use for making HTTP requests.

name

Get the provider name. Returns:
  • str: The provider name (‘anthropic’)

base_url

Get the base URL for the provider API. Returns:
  • str: The base URL for the provider API

client

Get the client for the provider. Returns:
  • AsyncAnthropicClient: The Anthropic client

model_profile

Get the model profile for the named model, if available. Parameters:
  • model_name (str): The name of the model
Returns:
  • ModelProfile | None: The model profile for the named model, if available
I