@@ -335,6 +335,7 @@ def copy(
335335 self ,
336336 * ,
337337 bearer_token : str  |  None  =  None ,
338+  api_token : str  |  None  =  None , # Legacy compatibility parameter 
338339 base_url : str  |  httpx .URL  |  None  =  None ,
339340 timeout : float  |  Timeout  |  None  |  NotGiven  =  NOT_GIVEN ,
340341 http_client : httpx .Client  |  None  =  None ,
@@ -347,7 +348,16 @@ def copy(
347348 ) ->  Self :
348349 """ 
349350 Create a new client instance re-using the same options given to the current client with optional overriding. 
351+ 
352+  For legacy compatibility, you can also pass `api_token` instead of `bearer_token`. 
350353 """ 
354+  # Handle legacy api_token parameter 
355+  if  api_token  is  not None  and  bearer_token  is  not None :
356+  raise  ValueError (
357+  "Cannot specify both 'bearer_token' and 'api_token'. Please use 'bearer_token' (recommended) or 'api_token' for legacy compatibility." 
358+  )
359+  if  api_token  is  not None :
360+  bearer_token  =  api_token 
351361 if  default_headers  is  not None  and  set_default_headers  is  not None :
352362 raise  ValueError ("The `default_headers` and `set_default_headers` arguments are mutually exclusive" )
353363
@@ -721,6 +731,7 @@ def copy(
721731 self ,
722732 * ,
723733 bearer_token : str  |  None  =  None ,
734+  api_token : str  |  None  =  None , # Legacy compatibility parameter 
724735 base_url : str  |  httpx .URL  |  None  =  None ,
725736 timeout : float  |  Timeout  |  None  |  NotGiven  =  NOT_GIVEN ,
726737 http_client : httpx .AsyncClient  |  None  =  None ,
@@ -733,7 +744,16 @@ def copy(
733744 ) ->  Self :
734745 """ 
735746 Create a new client instance re-using the same options given to the current client with optional overriding. 
747+ 
748+  For legacy compatibility, you can also pass `api_token` instead of `bearer_token`. 
736749 """ 
750+  # Handle legacy api_token parameter 
751+  if  api_token  is  not None  and  bearer_token  is  not None :
752+  raise  ValueError (
753+  "Cannot specify both 'bearer_token' and 'api_token'. Please use 'bearer_token' (recommended) or 'api_token' for legacy compatibility." 
754+  )
755+  if  api_token  is  not None :
756+  bearer_token  =  api_token 
737757 if  default_headers  is  not None  and  set_default_headers  is  not None :
738758 raise  ValueError ("The `default_headers` and `set_default_headers` arguments are mutually exclusive" )
739759
0 commit comments