22
33from __future__ import annotations
44
5- from typing import Dict
6- from typing_extensions import Literal , Required , Annotated , TypedDict
5+ from typing import Dict , Union
6+ from typing_extensions import Literal , Required , Annotated , TypeAlias , TypedDict
77
88from .._utils import PropertyInfo
99
10- __all__ = ["ModelConfigParam" ]
10+ __all__ = [
11+ "ModelConfigParam" ,
12+ "ProviderOptions" ,
13+ "ProviderOptionsBedrockAPIKeyProviderOptions" ,
14+ "ProviderOptionsBedrockAwsCredentialsProviderOptions" ,
15+ "ProviderOptionsGoogleVertexProviderOptions" ,
16+ "ProviderOptionsGoogleVertexProviderOptionsGoogleAuthOptions" ,
17+ "ProviderOptionsGoogleVertexProviderOptionsGoogleAuthOptionsCredentials" ,
18+ ]
19+
20+
21+ class ProviderOptionsBedrockAPIKeyProviderOptions (TypedDict , total = False ):
22+ region : Required [str ]
23+ """AWS region for Amazon Bedrock"""
24+
25+
26+ class ProviderOptionsBedrockAwsCredentialsProviderOptions (TypedDict , total = False ):
27+ access_key_id : Required [Annotated [str , PropertyInfo (alias = "accessKeyId" )]]
28+ """AWS access key ID for Bedrock"""
29+
30+ region : Required [str ]
31+ """AWS region for Amazon Bedrock"""
32+
33+ secret_access_key : Required [Annotated [str , PropertyInfo (alias = "secretAccessKey" )]]
34+ """AWS secret access key for Bedrock"""
35+
36+ session_token : Annotated [str , PropertyInfo (alias = "sessionToken" )]
37+ """Optional AWS session token for temporary credentials"""
38+
39+
40+ class ProviderOptionsGoogleVertexProviderOptionsGoogleAuthOptionsCredentials (TypedDict , total = False ):
41+ auth_provider_x509_cert_url : str
42+
43+ auth_uri : str
44+
45+ client_email : str
46+
47+ client_id : str
48+
49+ client_x509_cert_url : str
50+
51+ private_key : str
52+
53+ private_key_id : str
54+
55+ project_id : str
56+
57+ token_uri : str
58+
59+ type : str
60+
61+ universe_domain : str
62+
63+
64+ class ProviderOptionsGoogleVertexProviderOptionsGoogleAuthOptions (TypedDict , total = False ):
65+ """Optional Google auth options for Vertex AI"""
66+
67+ credentials : ProviderOptionsGoogleVertexProviderOptionsGoogleAuthOptionsCredentials
68+
69+
70+ class ProviderOptionsGoogleVertexProviderOptions (TypedDict , total = False ):
71+ google_auth_options : Annotated [
72+ ProviderOptionsGoogleVertexProviderOptionsGoogleAuthOptions , PropertyInfo (alias = "googleAuthOptions" )
73+ ]
74+ """Optional Google auth options for Vertex AI"""
75+
76+ headers : Dict [str , str ]
77+ """Custom headers for Vertex AI requests"""
78+
79+ location : str
80+ """Google Cloud location for Vertex AI"""
81+
82+ project : str
83+ """Google Cloud project ID for Vertex AI"""
84+
85+
86+ ProviderOptions : TypeAlias = Union [
87+ ProviderOptionsBedrockAPIKeyProviderOptions ,
88+ ProviderOptionsBedrockAwsCredentialsProviderOptions ,
89+ ProviderOptionsGoogleVertexProviderOptions ,
90+ ]
1191
1292
1393class ModelConfigParam (TypedDict , total = False ):
@@ -21,7 +101,20 @@ class ModelConfigParam(TypedDict, total=False):
21101 """Base URL for the model provider"""
22102
23103 headers : Dict [str , str ]
24- """Custom headers sent with every request to the model provider"""
104+ """Custom headers for the model provider"""
25105
26106 provider : Literal ["openai" , "anthropic" , "google" , "microsoft" , "bedrock" ]
27107 """AI provider for the model (or provide a baseURL endpoint instead)"""
108+
109+ provider_options : Annotated [ProviderOptions , PropertyInfo (alias = "providerOptions" )]
110+ """Provider-specific options passed through to the AI SDK provider constructor.
111+
112+ For Bedrock: { region, accessKeyId, secretAccessKey, sessionToken }. For Vertex:
113+ { project, location, googleAuthOptions }.
114+ """
115+
116+ skip_api_key_fallback : Annotated [bool , PropertyInfo (alias = "skipApiKeyFallback" )]
117+ """When true, hosted sessions will not copy x-model-api-key into model.apiKey.
118+
119+ Use this when auth is carried through providerOptions instead of an API key.
120+ """
0 commit comments