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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab26881afbb5870a65101d2118505e38bf9193e60d929cc40ec7be4bc6808ca8
4
- data.tar.gz: b403d02544b5dc14d31c148f4a43bc78137214ce88045351dba030dc0d8707c4
3
+ metadata.gz: a27af477a1da8a77d488c5a76e7de465cbf31e9f76baa1716198a08fe0c99842
4
+ data.tar.gz: a643f3c0767f7d4653ad353bf9c4e9afc2e71f90ce3cf23c0536fae7200cab2f
5
5
  SHA512:
6
- metadata.gz: 314a2930f8b7cc6940b17ff51c3c7fb834829b305bd275e99787408981ebbcfa9ceeb5b05984af8876131040c695bfa02dc5d7bfe3b8ffb4d97a62cfcec1cc54
7
- data.tar.gz: 0e251210f83fd64485cc29350232abcdda64dde3b73be765301f69ddfc5251dc32043d3e1c483c11691e8ce53662a8598e7554ec699c37b7ac9c896378bd7327
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module LLM
5
- VERSION = "0.8.4"
5
+ VERSION = "0.8.5"
6
6
  end
7
7
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-llm-providers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto