diff --git a/src/anthropic/_base_client.py b/src/anthropic/_base_client.py index a430b2ea..5e69696e 100644 --- a/src/anthropic/_base_client.py +++ b/src/anthropic/_base_client.py @@ -331,7 +331,7 @@ def __init__( self, *, version: str, - base_url: str, + base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None = DEFAULT_TIMEOUT, @@ -739,7 +739,7 @@ def __init__( self, *, version: str, - base_url: str, + base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, transport: Transport | None = None, @@ -1145,7 +1145,7 @@ def __init__( self, *, version: str, - base_url: str, + base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, diff --git a/src/anthropic/_client.py b/src/anthropic/_client.py index 2c0b88d3..07b32a97 100644 --- a/src/anthropic/_client.py +++ b/src/anthropic/_client.py @@ -4,7 +4,7 @@ import os import asyncio -from typing import Union, Mapping, Optional +from typing import Union, Mapping import httpx from tokenizers import Tokenizer # type: ignore[import] @@ -64,7 +64,7 @@ def __init__( *, api_key: str | None = None, auth_token: str | None = None, - base_url: Optional[str] = None, + base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, @@ -176,7 +176,7 @@ def copy( *, api_key: str | None = None, auth_token: str | None = None, - base_url: str | None = None, + base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, connection_pool_limits: httpx.Limits | None = None, @@ -316,7 +316,7 @@ def __init__( *, api_key: str | None = None, auth_token: str | None = None, - base_url: Optional[str] = None, + base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, @@ -428,7 +428,7 @@ def copy( *, api_key: str | None = None, auth_token: str | None = None, - base_url: str | None = None, + base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.AsyncClient | None = None, connection_pool_limits: httpx.Limits | None = None,