ask-llm-providers 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/ask/llm/version.rb +1 -1
- data/lib/ask/provider/openai_compatible.rb +24 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a27af477a1da8a77d488c5a76e7de465cbf31e9f76baa1716198a08fe0c99842
|
|
4
|
+
data.tar.gz: a643f3c0767f7d4653ad353bf9c4e9afc2e71f90ce3cf23c0536fae7200cab2f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e3ce29cf115e4d787ad8d3dc4ef8af24a2255f9bbbbf7c7a3e9cc794e50241de4ab8e2585d1dabb32e25e5354ec152519a0bf9159a7f5296c1388211b87ba61f
|
|
7
|
+
data.tar.gz: d04f1e5e22d99dafeced058754410e184a3098711db75cf3f4fbfb1eb52b9cfdfa5a153d36e3074f4054bbf624e0625fb10f690329220b103d6a52bfe1a9ea18
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [0.8.5] — 2026-07-18
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- **`OpenAICompatible#normalize_compat_config` now resolves credentials from `api_key_env` via `Ask::Auth`** — Previously the method only checked explicit config keys and environment variables. Now it also calls `Ask::Auth.resolve` using the downcased `api_key_env` name (e.g., `OPENCODE_API_KEY` → `:opencode_api_key` → resolves through Rails credentials at `opencode.api_key`, env, file, database, or OAuth). This fixes credential resolution for all 26 OpenAI-compatible providers when the API key is stored in Rails credentials, the ask credentials file, or any provider in the auth chain — not just environment variables.
|
|
6
|
+
|
|
1
7
|
## [0.8.4] — 2026-07-18
|
|
2
8
|
|
|
3
9
|
### Fixed
|
data/lib/ask/llm/version.rb
CHANGED
|
@@ -79,7 +79,8 @@ module Ask
|
|
|
79
79
|
config[:"#{slug}_api_key"] ||
|
|
80
80
|
ENV[@compat_cfg[:api_key_env].to_s] ||
|
|
81
81
|
(ENV[@compat_cfg[:alternate_env].to_s] if @compat_cfg[:alternate_env]) ||
|
|
82
|
-
ENV["#{slug.upcase}_API_KEY"]
|
|
82
|
+
ENV["#{slug.upcase}_API_KEY"] ||
|
|
83
|
+
resolve_credential_from_env_name
|
|
83
84
|
|
|
84
85
|
base_url = config[:base_url] || config["base_url"] ||
|
|
85
86
|
ENV["#{slug.upcase}_API_BASE"] ||
|
|
@@ -87,6 +88,28 @@ module Ask
|
|
|
87
88
|
|
|
88
89
|
Ask::LLM::Config.new(api_key:, base_url:)
|
|
89
90
|
end
|
|
91
|
+
|
|
92
|
+
# Uses the registry's +api_key_env+ as a credential name for
|
|
93
|
+
# Ask::Auth.resolve. This lets users store their API key under the
|
|
94
|
+
# canonical credential name (e.g., +opencode.api_key+ in Rails
|
|
95
|
+
# credentials) while using a specific variant provider
|
|
96
|
+
# (e.g., +opencode_go+) whose slug differs from the base name.
|
|
97
|
+
#
|
|
98
|
+
# For +opencode_go+ with +api_key_env: "OPENCODE_API_KEY"+,
|
|
99
|
+
# this resolves +:opencode_api_key+, which checks:
|
|
100
|
+
# ENV["OPENCODE_API_KEY"] →
|
|
101
|
+
# Rails.application.credentials.opencode.api_key
|
|
102
|
+
#
|
|
103
|
+
# @return [String, nil]
|
|
104
|
+
def resolve_credential_from_env_name
|
|
105
|
+
env_name = @compat_cfg[:api_key_env]
|
|
106
|
+
return nil unless env_name
|
|
107
|
+
|
|
108
|
+
cred_name = env_name.to_s.downcase
|
|
109
|
+
Ask::Auth.resolve(cred_name.to_sym)
|
|
110
|
+
rescue StandardError
|
|
111
|
+
nil
|
|
112
|
+
end
|
|
90
113
|
end
|
|
91
114
|
end
|
|
92
115
|
end
|