@sahan-sac/ai-core 0.4.0 → 0.5.0

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.
package/CHANGELOG.md CHANGED
@@ -1,40 +1,48 @@
1
- # @sahan-sac/ai-core
2
-
3
- ## 0.4.0
4
-
5
- ### Minor Changes
6
-
7
- - 396e692: Three more free-tier adapters:
8
- - `groq`: Groq free plan, keyed by `GROQ_API_KEY`. Default models `openai/gpt-oss-120b` for the blog and `openai/gpt-oss-20b` for chat.
9
- - `mistral`: Mistral free Experiment plan, keyed by `MISTRAL_API_KEY`. This plan may train on prompts, so the adapter runs in the blog chain only unless `AI_PROVIDER_ORDER_CHAT` lists it.
10
- - `cloudflare`: Cloudflare Workers AI, with 10,000 free neurons a day. Needs `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_AI_API_TOKEN`.
11
-
12
- None of them is paid, so none needs `AI_ALLOW_PAID`. Each model can be overridden per purpose. Adapters gain an optional `defaultPurposes`.
13
-
14
- ### Patch Changes
15
-
16
- - 1570cf6: A provider that answers 402 (no credits, or an empty prepaid wallet) now cools down for 30 minutes instead of being retried on every request, so an unfunded account costs one probe per window rather than a failed round trip each time. `cooldownFor` is exported.
17
-
18
- ## 0.3.1
19
-
20
- ### Patch Changes
21
-
22
- - 5e7f3cb: The build shares modules between subpaths (code splitting) instead of copying them into each one. Before, a class imported from two subpaths was two different classes, so `instanceof` failed (for example `EmailGuardError` from `@sahan-sac/email-kit/guards` against an error thrown through `./layout`), and module-level state such as caches existed once per subpath.
23
-
24
- ## 0.3.0
25
-
26
- ### Minor Changes
27
-
28
- - b9d2dd6: `createAiService().generate()` takes an optional `signal`. Aborting it stops the chain at once: running attempts are aborted, no further provider starts, and the result is `errorClass: "aborted"`. Aborted attempts are not logged and do not put a provider into cooldown.
29
- - 4fa21e3: Provider registry and more providers. New `@sahan-sac/ai-core/adapters`: each provider is an adapter with its own env guard and paid flag (`BUILTIN_ADAPTERS`), and `realProviders` builds the chain from it. Added OpenAI, Anthropic (Messages API over REST), DeepSeek, xAI, Perplexity and one custom OpenAI-compatible endpoint (`AI_CUSTOM_*`), all paid and gated by `AI_ALLOW_PAID` (the custom one unless `AI_CUSTOM_FREE`). `AI_PROVIDER_ORDER`, `AI_PROVIDER_ORDER_BLOG` and `AI_PROVIDER_ORDER_CHAT` choose which providers run and in what order; an explicit order is kept as given (`AiProvider.priority`), while cooling providers still drop behind healthy ones. `providerStatuses` explains each adapter's place for health screens, `textAiConfigured(env, purpose?)` checks one purpose's chain, and apps can pass their own adapters to `realProviders`. New factories `openAiCompatibleProvider` and `anthropicProvider`. Existing variables and `realProviders(env, purpose, fetch?)` work as before.
30
- - f465908: Owner guidance and on-demand checks. `@sahan-sac/ai-core/guard` adds `guidanceSection(text)`, which appends the site owner's standing guidance after a prompt's fixed rules (it steers, never overrides them, and never changes how fenced data is treated), `mergeGuidance(...parts)` to join global and per-feature guidance, and an optional `maxLength` on `wrapUserData`. `@sahan-sac/ai-core/adapters` adds `checkProvider(env, id)` and `checkChain(env, purpose)`: each sends a one-line prompt (a few tokens) through one adapter or a whole chain and reports who answered, how long it took and every fall-through, for a health screen's manual Check button. Neither runs on its own, and neither cools a provider down for real traffic.
31
-
32
- ## 0.2.0
33
-
34
- No changes in this release.
35
-
36
- ## 0.1.0
37
-
38
- ### Minor Changes
39
-
40
- - b620f44: First release. ai-core: the free-by-default provider chain (Gemini, OpenRouter, NVIDIA, then paid Vertex) with hedging, cooldowns and deadlines, env-driven model resolution, image generation, prompt guards and the shared env schema (ENABLE_BLOG_AI, ENABLE_CHATBOT). blog-kit: full-post, SEO, draft and cover generation, AI images through an ImageSink port, and pure blog utilities. chat-kit: runChat, guarded prompts, output filtering, the knowledge builder, the ChatStore contract and the visitor rate-limit cookie. Licensed Apache-2.0.
1
+ # @sahan-sac/ai-core
2
+
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c0127d5: OmniRoute provider. `omniroute` is a free adapter for a self-hosted OmniRoute gateway: one OpenAI-compatible endpoint that pools many providers' free tiers and fails over between them. It turns on with `OMNIROUTE_BASE_URL` (https, or http on localhost; `/v1` is added when missing; credentials in the URL are refused), sends `OMNIROUTE_API_KEY` when set, and defaults to the gateway's `auto/best-free` model (`OMNIROUTE_MODEL`, `BLOG_OMNIROUTE_MODEL` and `CHAT_OMNIROUTE_MODEL` override it). It is first in the default order, so it leads the chat and blog chains whenever it is configured, and it never needs `AI_ALLOW_PAID`.
8
+
9
+ Free only, even with `AI_ALLOW_PAID`: a model override that is not a free route (`isFreeRoute`: ends `-free` or `:free`) is replaced by `auto/best-free`. `OMNIROUTE_ALLOW_PAID` lets an override name a paid route, but only together with `AI_ALLOW_PAID`; the gateway then counts as paid for that purpose and runs as a last resort. `ProviderAdapter.paid` takes an optional `purpose`, so an adapter can be paid for one purpose and free for the other.
10
+
11
+ ## 0.4.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 396e692: Three more free-tier adapters:
16
+ - `groq`: Groq free plan, keyed by `GROQ_API_KEY`. Default models `openai/gpt-oss-120b` for the blog and `openai/gpt-oss-20b` for chat.
17
+ - `mistral`: Mistral free Experiment plan, keyed by `MISTRAL_API_KEY`. This plan may train on prompts, so the adapter runs in the blog chain only unless `AI_PROVIDER_ORDER_CHAT` lists it.
18
+ - `cloudflare`: Cloudflare Workers AI, with 10,000 free neurons a day. Needs `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_AI_API_TOKEN`.
19
+
20
+ None of them is paid, so none needs `AI_ALLOW_PAID`. Each model can be overridden per purpose. Adapters gain an optional `defaultPurposes`.
21
+
22
+ ### Patch Changes
23
+
24
+ - 1570cf6: A provider that answers 402 (no credits, or an empty prepaid wallet) now cools down for 30 minutes instead of being retried on every request, so an unfunded account costs one probe per window rather than a failed round trip each time. `cooldownFor` is exported.
25
+
26
+ ## 0.3.1
27
+
28
+ ### Patch Changes
29
+
30
+ - 5e7f3cb: The build shares modules between subpaths (code splitting) instead of copying them into each one. Before, a class imported from two subpaths was two different classes, so `instanceof` failed (for example `EmailGuardError` from `@sahan-sac/email-kit/guards` against an error thrown through `./layout`), and module-level state such as caches existed once per subpath.
31
+
32
+ ## 0.3.0
33
+
34
+ ### Minor Changes
35
+
36
+ - b9d2dd6: `createAiService().generate()` takes an optional `signal`. Aborting it stops the chain at once: running attempts are aborted, no further provider starts, and the result is `errorClass: "aborted"`. Aborted attempts are not logged and do not put a provider into cooldown.
37
+ - 4fa21e3: Provider registry and more providers. New `@sahan-sac/ai-core/adapters`: each provider is an adapter with its own env guard and paid flag (`BUILTIN_ADAPTERS`), and `realProviders` builds the chain from it. Added OpenAI, Anthropic (Messages API over REST), DeepSeek, xAI, Perplexity and one custom OpenAI-compatible endpoint (`AI_CUSTOM_*`), all paid and gated by `AI_ALLOW_PAID` (the custom one unless `AI_CUSTOM_FREE`). `AI_PROVIDER_ORDER`, `AI_PROVIDER_ORDER_BLOG` and `AI_PROVIDER_ORDER_CHAT` choose which providers run and in what order; an explicit order is kept as given (`AiProvider.priority`), while cooling providers still drop behind healthy ones. `providerStatuses` explains each adapter's place for health screens, `textAiConfigured(env, purpose?)` checks one purpose's chain, and apps can pass their own adapters to `realProviders`. New factories `openAiCompatibleProvider` and `anthropicProvider`. Existing variables and `realProviders(env, purpose, fetch?)` work as before.
38
+ - f465908: Owner guidance and on-demand checks. `@sahan-sac/ai-core/guard` adds `guidanceSection(text)`, which appends the site owner's standing guidance after a prompt's fixed rules (it steers, never overrides them, and never changes how fenced data is treated), `mergeGuidance(...parts)` to join global and per-feature guidance, and an optional `maxLength` on `wrapUserData`. `@sahan-sac/ai-core/adapters` adds `checkProvider(env, id)` and `checkChain(env, purpose)`: each sends a one-line prompt (a few tokens) through one adapter or a whole chain and reports who answered, how long it took and every fall-through, for a health screen's manual Check button. Neither runs on its own, and neither cools a provider down for real traffic.
39
+
40
+ ## 0.2.0
41
+
42
+ No changes in this release.
43
+
44
+ ## 0.1.0
45
+
46
+ ### Minor Changes
47
+
48
+ - b620f44: First release. ai-core: the free-by-default provider chain (Gemini, OpenRouter, NVIDIA, then paid Vertex) with hedging, cooldowns and deadlines, env-driven model resolution, image generation, prompt guards and the shared env schema (ENABLE_BLOG_AI, ENABLE_CHATBOT). blog-kit: full-post, SEO, draft and cover generation, AI images through an ImageSink port, and pure blog utilities. chat-kit: runChat, guarded prompts, output filtering, the knowledge builder, the ChatStore contract and the visitor rate-limit cookie. Licensed Apache-2.0.
package/LICENSE CHANGED
@@ -1,202 +1,202 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the
44
- purposes of this License, Derivative Works shall not include works
45
- that remain separable from, or merely link (or bind by name) to the
46
- interfaces of, the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including the
49
- original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright
52
- owner or by an individual or Legal Entity authorized to submit on
53
- behalf of the copyright owner. For the purposes of this definition,
54
- "submitted" means any form of electronic, verbal, or written
55
- communication sent to the Licensor or its representatives,
56
- including but not limited to communication on electronic mailing
57
- lists, source code control systems, and issue tracking systems
58
- that are managed by, or on behalf of, the Licensor for the purpose
59
- of discussing and improving the Work, but excluding communication
60
- that is conspicuously marked or otherwise designated in writing
61
- by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or Derivative
96
- Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing
142
- the origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright 2026 Sahan Sachintha
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the
44
+ purposes of this License, Derivative Works shall not include works
45
+ that remain separable from, or merely link (or bind by name) to the
46
+ interfaces of, the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including the
49
+ original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright
52
+ owner or by an individual or Legal Entity authorized to submit on
53
+ behalf of the copyright owner. For the purposes of this definition,
54
+ "submitted" means any form of electronic, verbal, or written
55
+ communication sent to the Licensor or its representatives,
56
+ including but not limited to communication on electronic mailing
57
+ lists, source code control systems, and issue tracking systems
58
+ that are managed by, or on behalf of, the Licensor for the purpose
59
+ of discussing and improving the Work, but excluding communication
60
+ that is conspicuously marked or otherwise designated in writing
61
+ by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or Derivative
96
+ Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing
142
+ the origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Sahan Sachintha
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -57,6 +57,8 @@ const schema = z.object({ ...aiEnvSchema.shape, DATABASE_URL: z.string() });
57
57
  | `OPENROUTER_BASE_URL`, `OPENROUTER_ALLOW_PAID_MODELS` | OpenRouter API, `false` | OpenRouter settings |
58
58
  | `OPENAI_API_KEY`, `OPENAI_BASE_URL` | unset, OpenAI API | OpenAI (paid); the base URL also points it at any OpenAI-compatible gateway |
59
59
  | `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL` | unset, Anthropic API | Anthropic Messages API over REST (paid) |
60
+ | `OMNIROUTE_BASE_URL`, `OMNIROUTE_API_KEY` | unset | Your self-hosted [OmniRoute](https://github.com/diegosouzapw/OmniRoute) gateway (https, or http on localhost; `/v1` added when missing) and its gateway key. Free only and first in the default order when set. Model `auto/best-free`; override with `OMNIROUTE_MODEL` or `BLOG_`/`CHAT_` variants. An override must be a free route (ends `-free` or `:free`), or the free default replaces it |
61
+ | `OMNIROUTE_ALLOW_PAID` | `false` | Lets an OmniRoute override name a paid route. `AI_ALLOW_PAID` alone never does; both must be on, and the paid route then runs as a last resort |
60
62
  | `GROQ_API_KEY` | unset | Groq free plan (no card). Models `openai/gpt-oss-120b` (blog) and `openai/gpt-oss-20b` (chat); override with `GROQ_MODEL` or `BLOG_`/`CHAT_` variants |
61
63
  | `MISTRAL_API_KEY` | unset | Mistral free (Experiment) plan, which may train on prompts. Blog chain only, unless `AI_PROVIDER_ORDER_CHAT` lists `mistral` |
62
64
  | `CLOUDFLARE_ACCOUNT_ID`, `CLOUDFLARE_AI_API_TOKEN` | unset | Cloudflare Workers AI, 10,000 free neurons a day. Models `@cf/openai/gpt-oss-120b` / `-20b`; override with `CLOUDFLARE_AI_MODEL` |
@@ -1,6 +1,6 @@
1
1
  import './env.js';
2
2
  import './models.js';
3
- export { A as AdapterContext, a as AdapterState, b as AdapterStatus, B as BUILTIN_ADAPTERS, C as CHECK_PROMPT, D as DEFAULT_ORDER, F as FREE_TEXT_MODELS, P as PAID_TEXT_MODELS, c as ProviderAdapter, d as ProviderCheck, e as chainPlan, f as checkChain, g as checkProvider, h as configuredOrder, p as providerStatuses, realProviders } from './providers.js';
3
+ export { A as AdapterContext, a as AdapterState, b as AdapterStatus, B as BUILTIN_ADAPTERS, C as CHECK_PROMPT, D as DEFAULT_ORDER, F as FREE_TEXT_MODELS, P as PAID_TEXT_MODELS, c as ProviderAdapter, d as ProviderCheck, e as chainPlan, f as checkChain, g as checkProvider, h as configuredOrder, i as isFreeRoute, o as omniRouteBaseUrl, j as omniRouteModel, p as providerStatuses, realProviders } from './providers.js';
4
4
  import 'zod';
5
5
  import './guard.js';
6
6
  import './log.js';
package/dist/adapters.js CHANGED
@@ -8,9 +8,12 @@ import {
8
8
  checkChain,
9
9
  checkProvider,
10
10
  configuredOrder,
11
+ isFreeRoute,
12
+ omniRouteBaseUrl,
13
+ omniRouteModel,
11
14
  providerStatuses,
12
15
  realProviders
13
- } from "./chunk-BK4B76LD.js";
16
+ } from "./chunk-D6KCXFSF.js";
14
17
  import "./chunk-BL4J2JNX.js";
15
18
  import "./chunk-PMC3UWQ2.js";
16
19
  import "./chunk-RBSLNDFW.js";
@@ -24,6 +27,9 @@ export {
24
27
  checkChain,
25
28
  checkProvider,
26
29
  configuredOrder,
30
+ isFreeRoute,
31
+ omniRouteBaseUrl,
32
+ omniRouteModel,
27
33
  providerStatuses,
28
34
  realProviders
29
35
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chainPlan
3
- } from "./chunk-BK4B76LD.js";
3
+ } from "./chunk-D6KCXFSF.js";
4
4
  import {
5
5
  imageConfigFromEnv
6
6
  } from "./chunk-MRNQPHWI.js";
@@ -24,6 +24,8 @@ function modelFor(env, provider, purpose, fallback) {
24
24
  }
25
25
  var need = (env, ...names) => names.filter((name) => !env[name]);
26
26
  var FREE_TEXT_MODELS = {
27
+ // OmniRoute's own alias: its "best free" combo, which only routes to free providers.
28
+ omniroute: { blog: "auto/best-free", chat: "auto/best-free" },
27
29
  groq: { blog: "openai/gpt-oss-120b", chat: "openai/gpt-oss-20b" },
28
30
  mistral: { blog: "mistral-medium-latest", chat: "mistral-small-latest" },
29
31
  cloudflare: { blog: "@cf/openai/gpt-oss-120b", chat: "@cf/openai/gpt-oss-20b" }
@@ -50,6 +52,28 @@ function compatibleAdapter(spec) {
50
52
  })
51
53
  };
52
54
  }
55
+ function omniRouteBaseUrl(env) {
56
+ const raw = env.OMNIROUTE_BASE_URL?.trim();
57
+ if (!raw) return null;
58
+ try {
59
+ const url = new URL(raw);
60
+ const local = /^(?:localhost|127\.0\.0\.1|\[::1\])$/.test(url.hostname);
61
+ if (url.username || url.password) return null;
62
+ if (!(url.protocol === "https:" || url.protocol === "http:" && local)) return null;
63
+ const base = `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
64
+ return base.endsWith("/v1") ? base : `${base}/v1`;
65
+ } catch {
66
+ return null;
67
+ }
68
+ }
69
+ function isFreeRoute(model) {
70
+ return /[-:/]free$/i.test(model.trim());
71
+ }
72
+ function omniRouteModel(env, purpose) {
73
+ const model = modelFor(env, "OMNIROUTE", purpose, FREE_TEXT_MODELS.omniroute);
74
+ return isFreeRoute(model) || env.OMNIROUTE_ALLOW_PAID && paidAllowed(env) ? model : FREE_TEXT_MODELS.omniroute[purpose];
75
+ }
76
+ var PURPOSES = ["blog", "chat"];
53
77
  var openRouterAdapter = (id, keyVar) => ({
54
78
  id,
55
79
  label: id === "openrouter" ? "OpenRouter" : "OpenRouter (second key)",
@@ -66,6 +90,25 @@ var openRouterAdapter = (id, keyVar) => ({
66
90
  })
67
91
  });
68
92
  var BUILTIN_ADAPTERS = [
93
+ {
94
+ // OmniRoute: a self-hosted gateway that pools many providers' free tiers
95
+ // behind one OpenAI-compatible endpoint and fails over between them. First
96
+ // in the default order, so it leads whenever its address is set. Free only
97
+ // unless OMNIROUTE_ALLOW_PAID (see omniRouteModel); a paid route then
98
+ // counts as paid, so it runs as a last resort like any paid provider.
99
+ id: "omniroute",
100
+ label: "OmniRoute (self-hosted gateway)",
101
+ paid: (env, purpose) => (purpose ? [purpose] : PURPOSES).some((each) => !isFreeRoute(omniRouteModel(env, each))),
102
+ missing: (env) => omniRouteBaseUrl(env) ? [] : ["OMNIROUTE_BASE_URL"],
103
+ create: ({ env, purpose, fetch: fetch2 }) => openAiCompatibleProvider({
104
+ name: "omniroute",
105
+ // A gateway may run without keys; the header must still be well formed.
106
+ apiKey: env.OMNIROUTE_API_KEY || "none",
107
+ baseUrl: omniRouteBaseUrl(env),
108
+ model: omniRouteModel(env, purpose),
109
+ fetch: fetch2
110
+ })
111
+ },
69
112
  {
70
113
  id: "gemini",
71
114
  label: "Gemini",
@@ -195,13 +238,13 @@ function providerStatuses(env, purpose, adapters = BUILTIN_ADAPTERS) {
195
238
  continue;
196
239
  }
197
240
  const missing = adapter.missing(env);
198
- const paid = adapter.paid(env);
241
+ const paid = adapter.paid(env, purpose);
199
242
  const state = missing.length ? "not_configured" : paid && !paidAllowed(env) ? "needs_paid" : "active";
200
243
  statuses.push({ id, label: adapter.label, paid, state, missing, ...state === "active" ? { position: position++ } : {} });
201
244
  }
202
245
  for (const adapter of adapters) {
203
246
  if (!ids.includes(adapter.id)) {
204
- statuses.push({ id: adapter.id, label: adapter.label, paid: adapter.paid(env), state: "not_in_order", missing: adapter.missing(env) });
247
+ statuses.push({ id: adapter.id, label: adapter.label, paid: adapter.paid(env, purpose), state: "not_in_order", missing: adapter.missing(env) });
205
248
  }
206
249
  }
207
250
  return statuses;
@@ -250,7 +293,7 @@ function realProviders(env, purpose, fetchImpl, adapters = BUILTIN_ADAPTERS) {
250
293
  const explicit = configuredOrder(env, purpose) !== null;
251
294
  return chainPlan(env, purpose, adapters).map((adapter, index) => {
252
295
  const provider = adapter.create({ env, purpose, fetch: fetchImpl });
253
- return explicit ? { name: provider.name, generate: provider.generate, priority: index } : { name: provider.name, generate: provider.generate, lastResort: adapter.paid(env) || provider.lastResort };
296
+ return explicit ? { name: provider.name, generate: provider.generate, priority: index } : { name: provider.name, generate: provider.generate, lastResort: adapter.paid(env, purpose) || provider.lastResort };
254
297
  });
255
298
  }
256
299
 
@@ -609,6 +652,9 @@ export {
609
652
  vertexProvider,
610
653
  FREE_TEXT_MODELS,
611
654
  PAID_TEXT_MODELS,
655
+ omniRouteBaseUrl,
656
+ isFreeRoute,
657
+ omniRouteModel,
612
658
  BUILTIN_ADAPTERS,
613
659
  DEFAULT_ORDER,
614
660
  configuredOrder,
@@ -26,6 +26,16 @@ var aiEnvSchema = z.object({
26
26
  OPENROUTER_ALLOW_PAID_MODELS: flag,
27
27
  GEMINI_API_KEY: text,
28
28
  NVIDIA_API_KEY: text,
29
+ // OmniRoute (./adapters): a self-hosted gateway pooling free tiers. The
30
+ // address turns it on; the key is a gateway key from its dashboard.
31
+ OMNIROUTE_BASE_URL: text,
32
+ OMNIROUTE_API_KEY: text,
33
+ OMNIROUTE_MODEL: text,
34
+ BLOG_OMNIROUTE_MODEL: text,
35
+ CHAT_OMNIROUTE_MODEL: text,
36
+ // Lets an OmniRoute model override name a paid route; AI_ALLOW_PAID must be
37
+ // on as well. Off: only free routes (`-free`, `:free`) are ever sent.
38
+ OMNIROUTE_ALLOW_PAID: flag,
29
39
  // More free tiers (./adapters). Groq: free plan, no card. Mistral: free
30
40
  // Experiment plan, which may train on prompts, so it joins the chat chain
31
41
  // only when AI_PROVIDER_ORDER_CHAT lists it. Cloudflare Workers AI: 10,000
package/dist/env.d.ts CHANGED
@@ -11,6 +11,12 @@ declare const aiEnvSchema: z.ZodObject<{
11
11
  OPENROUTER_ALLOW_PAID_MODELS: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<boolean, string | undefined>>;
12
12
  GEMINI_API_KEY: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
13
13
  NVIDIA_API_KEY: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
14
+ OMNIROUTE_BASE_URL: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
15
+ OMNIROUTE_API_KEY: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
16
+ OMNIROUTE_MODEL: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
17
+ BLOG_OMNIROUTE_MODEL: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
18
+ CHAT_OMNIROUTE_MODEL: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
19
+ OMNIROUTE_ALLOW_PAID: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<boolean, string | undefined>>;
14
20
  GROQ_API_KEY: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
15
21
  GROQ_MODEL: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
16
22
  BLOG_GROQ_MODEL: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
package/dist/env.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  aiEnvFromProcess,
4
4
  aiEnvSchema,
5
5
  parseAiEnv
6
- } from "./chunk-SI7JE5BG.js";
6
+ } from "./chunk-TEOP42ST.js";
7
7
  export {
8
8
  DEFAULT_GOOGLE_TOKEN_URI,
9
9
  aiEnvFromProcess,
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  aiEnvFromProcess,
3
3
  aiEnvSchema,
4
4
  parseAiEnv
5
- } from "./chunk-SI7JE5BG.js";
5
+ } from "./chunk-TEOP42ST.js";
6
6
  export {
7
7
  aiEnvFromProcess,
8
8
  aiEnvSchema,
@@ -200,8 +200,11 @@ interface ProviderAdapter {
200
200
  * AI_PROVIDER_ORDER(_BLOG|_CHAT) still adds it anywhere it is listed.
201
201
  */
202
202
  readonly defaultPurposes?: readonly TextPurpose[];
203
- /** Costs money: runs only with AI_ALLOW_PAID. */
204
- paid(env: AiEnv): boolean;
203
+ /**
204
+ * Costs money: runs only with AI_ALLOW_PAID. `purpose` is set when the
205
+ * answer can differ per purpose; without it, true when any purpose is paid.
206
+ */
207
+ paid(env: AiEnv, purpose?: TextPurpose): boolean;
205
208
  /** Env variable names still missing; empty means configured. Never values. */
206
209
  missing(env: AiEnv): string[];
207
210
  create(context: AdapterContext): AiProvider;
@@ -211,6 +214,10 @@ interface ProviderAdapter {
211
214
  * writes long JSON, so it gets the larger model; chat gets the faster one.
212
215
  */
213
216
  declare const FREE_TEXT_MODELS: {
217
+ readonly omniroute: {
218
+ readonly blog: "auto/best-free";
219
+ readonly chat: "auto/best-free";
220
+ };
214
221
  readonly groq: {
215
222
  readonly blog: "openai/gpt-oss-120b";
216
223
  readonly chat: "openai/gpt-oss-20b";
@@ -250,6 +257,21 @@ declare const PAID_TEXT_MODELS: {
250
257
  readonly chat: "sonar";
251
258
  };
252
259
  };
260
+ /**
261
+ * OMNIROUTE_BASE_URL as the gateway's `/v1` base, or null when unset or unsafe.
262
+ * https only, except plain http on localhost for a gateway on the same machine;
263
+ * never credentials in the URL.
264
+ */
265
+ declare function omniRouteBaseUrl(env: AiEnv): string | null;
266
+ /** An OmniRoute model id that names a free route: `auto/best-free`, `<provider>/<model>:free`. */
267
+ declare function isFreeRoute(model: string): boolean;
268
+ /**
269
+ * The OmniRoute model for a purpose. Free only by default: an override that is
270
+ * not a free route counts only with OMNIROUTE_ALLOW_PAID and AI_ALLOW_PAID both
271
+ * on; otherwise the free default replaces it, so the gateway keeps answering
272
+ * for free instead of dropping out of the chain.
273
+ */
274
+ declare function omniRouteModel(env: AiEnv, purpose: TextPurpose): string;
253
275
  declare const BUILTIN_ADAPTERS: readonly ProviderAdapter[];
254
276
  /** Free tiers first (fastest, most reliable first), paid last. */
255
277
  declare const DEFAULT_ORDER: string[];
@@ -320,4 +342,4 @@ declare function checkChain(env: AiEnv, purpose: TextPurpose, options?: {
320
342
  */
321
343
  declare function realProviders(env: AiEnv, purpose: TextPurpose, fetchImpl?: typeof fetch, adapters?: readonly ProviderAdapter[]): AiProvider[];
322
344
 
323
- export { type AdapterContext as A, AI_COOLDOWN_MS, AI_TIMEOUT_MS, type AiAttempt, type AiAttemptStatus, type AiGenerateOptions, type AiHealth, type AiOutcome, type AiProvider, type AiResult, type AiServiceDeps, BUILTIN_ADAPTERS as B, CHECK_PROMPT as C, DEFAULT_ORDER as D, FREE_TEXT_MODELS as F, HEDGE, type JsonMode, PAID_TEXT_MODELS as P, type AdapterState as a, anthropicOutcome, anthropicProvider, type AdapterStatus as b, type ProviderAdapter as c, cooldownFor, createAiHealth, createAiService, type ProviderCheck as d, chainPlan as e, checkChain as f, checkProvider as g, geminiOutcome, geminiProvider, configuredOrder as h, nvidiaProvider, openAiCompatibleProvider, openRouterProvider, providerStatuses as p, realProviders, sharedAiHealth, vertexProvider };
345
+ export { type AdapterContext as A, AI_COOLDOWN_MS, AI_TIMEOUT_MS, type AiAttempt, type AiAttemptStatus, type AiGenerateOptions, type AiHealth, type AiOutcome, type AiProvider, type AiResult, type AiServiceDeps, BUILTIN_ADAPTERS as B, CHECK_PROMPT as C, DEFAULT_ORDER as D, FREE_TEXT_MODELS as F, HEDGE, type JsonMode, PAID_TEXT_MODELS as P, type AdapterState as a, anthropicOutcome, anthropicProvider, type AdapterStatus as b, type ProviderAdapter as c, cooldownFor, createAiHealth, createAiService, type ProviderCheck as d, chainPlan as e, checkChain as f, checkProvider as g, geminiOutcome, geminiProvider, configuredOrder as h, isFreeRoute as i, omniRouteModel as j, nvidiaProvider, omniRouteBaseUrl as o, openAiCompatibleProvider, openRouterProvider, providerStatuses as p, realProviders, sharedAiHealth, vertexProvider };
package/dist/providers.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  realProviders,
16
16
  sharedAiHealth,
17
17
  vertexProvider
18
- } from "./chunk-BK4B76LD.js";
18
+ } from "./chunk-D6KCXFSF.js";
19
19
  import "./chunk-BL4J2JNX.js";
20
20
  import "./chunk-PMC3UWQ2.js";
21
21
  import "./chunk-RBSLNDFW.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sahan-sac/ai-core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Free-by-default AI provider chain with fallback (chain of responsibility over provider adapters: Gemini, OpenRouter, NVIDIA, OpenAI, Anthropic, DeepSeek, xAI, Perplexity, any OpenAI-compatible endpoint, Vertex), env-configurable order, hedging, cooldowns and deadlines, image generation and prompt-injection guards. Shared by @sahan-sac/blog-kit and @sahan-sac/chat-kit.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {