ask-llm-providers 0.8.3 → 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 +12 -0
- data/lib/ask/llm/version.rb +1 -1
- data/lib/ask/provider/openai.rb +1 -0
- data/lib/ask/provider/openai_compatible.rb +25 -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,15 @@
|
|
|
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
|
+
|
|
7
|
+
## [0.8.4] — 2026-07-18
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **`normalize_config` (OpenAI) and `normalize_compat_config` (OpenAICompatible) — Config object handling** — `Chat#provider_config` creates an `Ask::LLM::Config` object, but both methods previously bailed out with `return config unless config.is_a?(Hash)`, allowing the Config object to pass through without API key resolution. Now they call `config.to_h` when the object responds to it before the Hash guard, ensuring env vars like `OPENCODE_API_KEY` are properly resolved for all OpenAI-compatible providers. Fixes auth for all 20+ OpenAI-compatible providers when config arrives as a Config object.
|
|
12
|
+
|
|
1
13
|
## [0.8.1] — 2026-07-17
|
|
2
14
|
|
|
3
15
|
### Added
|
data/lib/ask/llm/version.rb
CHANGED
data/lib/ask/provider/openai.rb
CHANGED
|
@@ -71,6 +71,7 @@ module Ask
|
|
|
71
71
|
private
|
|
72
72
|
|
|
73
73
|
def normalize_compat_config(config)
|
|
74
|
+
config = config.to_h if config.respond_to?(:to_h)
|
|
74
75
|
return config unless config.is_a?(Hash)
|
|
75
76
|
|
|
76
77
|
slug = self.class.slug
|
|
@@ -78,7 +79,8 @@ module Ask
|
|
|
78
79
|
config[:"#{slug}_api_key"] ||
|
|
79
80
|
ENV[@compat_cfg[:api_key_env].to_s] ||
|
|
80
81
|
(ENV[@compat_cfg[:alternate_env].to_s] if @compat_cfg[:alternate_env]) ||
|
|
81
|
-
ENV["#{slug.upcase}_API_KEY"]
|
|
82
|
+
ENV["#{slug.upcase}_API_KEY"] ||
|
|
83
|
+
resolve_credential_from_env_name
|
|
82
84
|
|
|
83
85
|
base_url = config[:base_url] || config["base_url"] ||
|
|
84
86
|
ENV["#{slug.upcase}_API_BASE"] ||
|
|
@@ -86,6 +88,28 @@ module Ask
|
|
|
86
88
|
|
|
87
89
|
Ask::LLM::Config.new(api_key:, base_url:)
|
|
88
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
|
|
89
113
|
end
|
|
90
114
|
end
|
|
91
115
|
end
|