You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Release v0.12.0: Gemini authentication precedence and Live session API key support
- Update default Gemini auth resolution to prioritize application configuration
(config :gemini_ex, api_key: ...) over the GEMINI_API_KEY environment variable.
- Modify Gemini.Client.HTTP to implicitly select Gemini auth when an api_key is
passed, even if the :auth option is omitted.
- Enable Live session API key propagation by updating Gemini.Live.Session to
pass per-session credentials through to WebSocket connections.
- Ensure WebSocket auth resolution favors connection-scoped keys before falling
back to global configuration.
- Enhance documentation for the updated precedence order and session-scoped
override paths.
- Add regression tests for config precedence, implicit HTTP auth selection,
and proper propagation of Live session API keys.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
## [0.12.0] - 2026-04-02
11
+
12
+
### Changed
13
+
-**Gemini API key precedence**: default Gemini auth now prefers application configuration over `GEMINI_API_KEY`, making `config :gemini_ex, api_key: ...` the explicit default when both are present
14
+
-**Published auth docs**: README, the Live API guide, and the authentication guide now document the new precedence order and the session-scoped Live override path
15
+
16
+
### Fixed
17
+
-**Implicit Gemini override selection**: `Gemini.Client.HTTP` now treats a request-scoped `api_key:` as sufficient to select Gemini auth even when `auth:` is omitted
18
+
-**Live session API key overrides**: `Gemini.Live.Session.start_link/1` now propagates `api_key:` through to `Gemini.Client.WebSocket`, so per-session Gemini credentials do not depend on global config
19
+
-**WebSocket auth resolution**: Gemini Live connections now prefer a connection-scoped API key before falling back to global configuration, with redacted logging preserved
20
+
21
+
### Tests
22
+
- Added focused regression coverage for config precedence, implicit HTTP auth selection, and Live session/WebSocket API key propagation
Copy file name to clipboardExpand all lines: README.md
+17-5Lines changed: 17 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ Add `gemini` to your list of dependencies in `mix.exs`:
59
59
```elixir
60
60
defdepsdo
61
61
[
62
-
{:gemini_ex, "~> 0.11.1"}
62
+
{:gemini_ex, "~> 0.12.0"}
63
63
]
64
64
end
65
65
```
@@ -83,6 +83,8 @@ Or set the environment variable:
83
83
export GEMINI_API_KEY="your_api_key_here"
84
84
```
85
85
86
+
For default Gemini auth resolution, `config :gemini_ex, api_key: ...` now takes precedence over `GEMINI_API_KEY`. Narrower overrides still win: pass `api_key:` directly on a request or on `Gemini.Live.Session.start_link/1` for session-scoped credentials.
87
+
86
88
### Simple Content Generation
87
89
88
90
```elixir
@@ -1377,15 +1379,25 @@ The examples follow a consistent pattern:
Copy file name to clipboardExpand all lines: guides/AUTHENTICATION_SYSTEM.md
+21-11Lines changed: 21 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,18 +103,16 @@ graph TD
103
103
104
104
***Purpose**: To detect and load the *default* authentication credentials for the application.
105
105
***Mechanism**: The `Gemini.Config.auth_config/0` function establishes a strict priority order for finding credentials:
106
-
1.**Environment Variables**: Checks for `GEMINI_API_KEY`, `VERTEX_SERVICE_ACCOUNT`/`VERTEX_JSON_FILE`, and ADC vars such as `GOOGLE_APPLICATION_CREDENTIALS_JSON` and `GOOGLE_APPLICATION_CREDENTIALS`. This is the highest priority.
107
-
2.**Application Config**: If no environment variables are found, it checks for `:gemini, :auth` or `:gemini, :api_key` in the Elixir application environment (e.g., `config/runtime.exs`).
106
+
1.**Application Config**: Checks `:gemini, :auth`, `:gemini_ex, :auth`, and Gemini API keys configured via `:gemini` or `:gemini_ex`.
107
+
2.**Environment Variables**: Falls back to `GEMINI_API_KEY`, `VERTEX_SERVICE_ACCOUNT`/`VERTEX_JSON_FILE`, and ADC vars such as `GOOGLE_APPLICATION_CREDENTIALS_JSON` and `GOOGLE_APPLICATION_CREDENTIALS`.
108
+
3.**Per-request / per-session overrides**: Higher layers can still override the resolved defaults by passing `:api_key`, `:project_id`, or other auth opts directly on a request or Live session.
The WebSocket connection URL includes the API key as a query parameter when Gemini auth is used, and that query parameter is automatically redacted in logs for security.
287
297
288
298
#### Client-Side Authentication with Ephemeral Tokens
Copy file name to clipboardExpand all lines: guides/live_api.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -286,6 +286,16 @@ model = Models.resolve(:text)
286
286
# Session is now ready for messages
287
287
```
288
288
289
+
For Gemini sessions, you can also pass `api_key:` directly to `Session.start_link/1`. When `api_key:` is present and `auth:` is omitted, the session uses Gemini auth for that connection only.
0 commit comments