13
13
// limitations under the License.
14
14
15
15
/// Configuration for the generative AI backend API used by this SDK.
16
- struct APIConfig : Sendable , Hashable {
16
+ struct APIConfig : Sendable , Hashable , Encodable {
17
17
/// The service to use for generative AI.
18
18
///
19
19
/// This controls which backend API is used by the SDK.
@@ -39,7 +39,7 @@ extension APIConfig {
39
39
/// See [Vertex AI and Google AI
40
40
/// differences](https://cloud.google.com/vertex-ai/generative-ai/docs/overview#how-gemini-vertex-different-gemini-aistudio)
41
41
/// for a comparison of the two [API services](https://google.aip.dev/9#api-service).
42
- enum Service : Hashable {
42
+ enum Service : Hashable , Encodable {
43
43
/// The Gemini Enterprise API provided by Vertex AI.
44
44
///
45
45
/// See the [Cloud
@@ -50,7 +50,7 @@ extension APIConfig {
50
50
/// The Gemini Developer API provided by Google AI.
51
51
///
52
52
/// See the [Google AI docs](https://ai.google.dev/gemini-api/docs) for more details.
53
- case developer ( endpoint: Endpoint )
53
+ case googleAI ( endpoint: Endpoint )
54
54
55
55
/// The specific network address to use for API requests.
56
56
///
@@ -59,7 +59,7 @@ extension APIConfig {
59
59
switch self {
60
60
case let . vertexAI( endpoint: endpoint) :
61
61
return endpoint
62
- case let . developer ( endpoint: endpoint) :
62
+ case let . googleAI ( endpoint: endpoint) :
63
63
return endpoint
64
64
}
65
65
}
@@ -68,21 +68,30 @@ extension APIConfig {
68
68
69
69
extension APIConfig . Service {
70
70
/// Network addresses for generative AI API services.
71
- enum Endpoint : String {
72
- /// The Firebase AI SDK production endpoint.
73
- case firebaseVertexAIProd = " https://firebasevertexai.googleapis.com "
71
+ enum Endpoint : String , Encodable {
72
+ /// The Firebase proxy production endpoint.
73
+ ///
74
+ /// This endpoint supports both Google AI and Vertex AI.
75
+ case firebaseProxyProd = " https://firebasevertexai.googleapis.com "
74
76
75
- /// The Firebase AI SDK staging endpoint; for SDK development and testing only.
76
- case firebaseVertexAIStaging = " https://staging-firebasevertexai.sandbox.googleapis.com "
77
+ /// The Firebase proxy staging endpoint; for SDK development and testing only.
78
+ ///
79
+ /// This endpoint supports both the Gemini Developer API (commonly referred to as Google AI)
80
+ /// and the Gemini API in Vertex AI (commonly referred to simply as Vertex AI).
81
+ case firebaseProxyStaging = " https://staging-firebasevertexai.sandbox.googleapis.com "
77
82
78
- /// The Gemini Developer API production endpoint; for SDK development and testing only.
79
- case generativeLanguage = " https://generativelanguage.googleapis.com "
83
+ /// The Gemini Developer API (Google AI) direct production endpoint; for SDK development and
84
+ /// testing only.
85
+ ///
86
+ /// This bypasses the Firebase proxy and directly connects to the Gemini Developer API
87
+ /// (Google AI) backend. This endpoint only supports the Gemini Developer API, not Vertex AI.
88
+ case googleAIBypassProxy = " https://generativelanguage.googleapis.com "
80
89
}
81
90
}
82
91
83
92
extension APIConfig {
84
93
/// Versions of the configured API service (`APIConfig.Service`).
85
- enum Version : String {
94
+ enum Version : String , Encodable {
86
95
/// The stable channel for version 1 of the API.
87
96
case v1
88
97
0 commit comments