Skip to content

Commit 78b3981

Browse files
committed
Custom providers do not require the existense of key or keyEnv.
Fixes #194
1 parent d4bcad7 commit 78b3981

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Custom providers do not require the existense of `key` or `keyEnv`. #194
6+
57
## 0.76.0
68

79
- Updated instructions for `/login` command and invalid input handling.

src/eca/config.clj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
:url "https://api.openai.com"
3939
:key nil
4040
:keyEnv "OPENAI_API_KEY"
41+
:requiresAuth? true
4142
:models {"gpt-5-codex" {}
4243
"gpt-5" {}
4344
"gpt-5-mini" {}
@@ -49,6 +50,7 @@
4950
:url "https://api.anthropic.com"
5051
:key nil
5152
:keyEnv "ANTHROPIC_API_KEY"
53+
:requiresAuth? true
5254
:models {"claude-sonnet-4-5-20250929" {}
5355
"claude-sonnet-4-20250514" {}
5456
"claude-opus-4-1-20250805" {}
@@ -58,6 +60,7 @@
5860
:url "https://api.githubcopilot.com"
5961
:key nil ;; not supported, requires login auth
6062
:keyEnv nil ;; not supported, requires login auth
63+
:requiresAuth? true
6164
:models {"claude-haiku-4.5" {}
6265
"claude-opus-4.1" {}
6366
"claude-sonnet-4.5" {}
@@ -71,6 +74,7 @@
7174
:url "https://generativelanguage.googleapis.com/v1beta/openai"
7275
:key nil
7376
:keyEnv "GOOGLE_API_KEY"
77+
:requiresAuth? true
7478
:models {"gemini-2.0-flash" {}
7579
"gemini-2.5-pro" {}}}
7680
"ollama" {:url "http://localhost:11434"

src/eca/models.clj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@
6666

6767
(defn ^:private auth-valid? [full-model db config]
6868
(let [[provider _model] (string/split full-model #"/" 2)]
69-
(and (llm-util/provider-api-url provider config)
70-
(llm-util/provider-api-key provider (get-in db [:auth provider]) config))))
69+
(or (not (get-in config [:providers provider :requiresAuth?] false))
70+
(and (llm-util/provider-api-url provider config)
71+
(llm-util/provider-api-key provider (get-in db [:auth provider]) config)))))
7172

7273
(defn sync-models! [db* config on-models-updated]
7374
(let [all-models (all)
@@ -97,8 +98,6 @@
9798
(:models provider-config))))
9899
{}
99100
(:providers config))
100-
authenticated-models (into {}
101-
(filter #(auth-valid? (first %) db config) all-supported-models))
102101
ollama-api-url (llm-util/provider-api-url "ollama" config)
103102
ollama-models (mapv
104103
(fn [{:keys [model] :as ollama-model}]
@@ -114,6 +113,8 @@
114113
(select-keys ollama-model [:tools :reason?])))
115114
{}
116115
ollama-models)
116+
authenticated-models (into {}
117+
(filter #(auth-valid? (first %) db config) all-supported-models))
117118
all-models (merge authenticated-models local-models)]
118119
(swap! db* assoc :models all-models)
119120
(on-models-updated all-models)))

0 commit comments

Comments
 (0)