Skip to content

Commit 8ad8585

Browse files
N6REJclaude
andcommitted
Default to OpenRouter free models: Zen's free tier is API-gated
A live module returned: AI API request failed (status 403): OpenCode's free tier can only be used from within OpenCode That is a deliberate provider gate, not a bad key. Zen's free tier only answers the genuine opencode binary; the check is on User-Agent, so every third-party HTTP client is refused even with a valid key. Reported upstream as anomalyco/opencode#49621, after a change that landed around 19-20 September and broke setups that had worked. Both shipped defaults, big-pickle and space-bunny-free, are free-tier models, so the module could not work at all as configured. Move the defaults to OpenRouter, whose free :free variants are usable through the documented OpenAI-compatible API: endpoint https://openrouter.ai/api/v1/chat/completions model qwen/qwen3.8-27b:free fallback google/gemma-4-31b-it:free Both verified present and priced 0/0 on the live models API, and both accept max_tokens and temperature, which is all the module sends. The fallback is a different family so a single provider outage does not take out both. No UA spoofing: overriding the User-Agent to defeat the gate would circumvent an intentional access control and has already broken once. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 parent 0487364 commit 8ad8585

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

‎README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A Joomla 5.4/6 site module that adds a floating **AI chat widget** to your site.
44

55
## Features
66

7-
- **Grounded AI chat** — a floating chat widget backed by any OpenAI-compatible chat completions API. The default is OpenCode Zen, so a free OpenCode key is enough; point the endpoint, key and model at any other service if you prefer. Answers are grounded strictly in your site content.
7+
- **Grounded AI chat** — a floating chat widget backed by any OpenAI-compatible chat completions API. The default is OpenRouter with a free model variant, so a free OpenRouter key is enough; point the endpoint, key and model at any other service if you prefer. Answers are grounded strictly in your site content.
88
- **Prompt-grounded answers** — the AI receives the articles, FAQ entries and forum topics you select as context and is instructed to answer only from that content, falling back to a configurable message when no knowledge matches. Content is used as grounding context only; the module does not render content blocks of its own.
99
- **You choose the knowledge base** — multi-select the article categories to draw from, point the FAQ field at your FAQ category, and opt in to Kunena forum topics with a single switch. Installing Kunena never changes what the AI can see.
1010
- **Customizable chat UI**:
@@ -25,7 +25,7 @@ A Joomla 5.4/6 site module that adds a floating **AI chat widget** to your site.
2525
- Joomla 5.4 or newer (Joomla 6 ready)
2626
- PHP 8.1 or newer
2727
- Kunena 6.x (optional, only when you switch on *Include Kunena forum topics*)
28-
- An AI service API key (optional, only for the chat widget). With the default endpoint this is an OpenCode Zen key; any OpenAI-compatible service works if you also set the endpoint and model.
28+
- An AI service API key (optional, only for the chat widget). With the default endpoint this is an OpenRouter key; any OpenAI-compatible service works if you also set the endpoint and model.
2929

3030
## Installation
3131

@@ -52,10 +52,10 @@ See [Choosing the knowledge base content](#choosing-the-knowledge-base-content)
5252
| Parameter | Description |
5353
| --- | --- |
5454
| Show AI chat widget | Enable the floating chat widget. |
55-
| AI API key | API key for the AI service. With the default endpoint this is an OpenCode Zen key. Read on the server only; never sent to the browser. |
56-
| AI model | Model to use, e.g. `big-pickle` (default). |
57-
| Fallback model | Tried once if the primary request times out, is rate limited (HTTP 429) or returns a server error (HTTP 5xx); defaults to `space-bunny-free`. Leave blank to disable. |
58-
| AI endpoint | OpenAI-compatible chat completions endpoint (defaults to OpenCode Zen). |
55+
| AI API key | API key for the AI service. With the default endpoint this is an OpenRouter key. Read on the server only; never sent to the browser. |
56+
| AI model | Model to use, e.g. `qwen/qwen3.8-27b:free` (default). |
57+
| Fallback model | Tried once if the primary request times out, is rate limited (HTTP 429) or returns a server error (HTTP 5xx); defaults to `google/gemma-4-31b-it:free`. Leave blank to disable. |
58+
| AI endpoint | OpenAI-compatible chat completions endpoint (defaults to OpenRouter). |
5959
| Max response tokens | 64–4096, default 512. |
6060
| Temperature | 0–1, default 0.2 (low = factual answers). |
6161
| Request timeout (seconds) | 5–120, default 30. |

‎language/en-GB/mod_bearsamppai.ini‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; Note: All translation files should be saved with UTF-8 encoding.
33

44
MOD_BEARSAMPPAI="Bearsampp AI"
5-
MOD_BEARSAMPPAI_XML_DESCRIPTION="Joomla 5.4/6 ready floating AI chat widget. Answers visitor questions through an OpenAI-compatible AI API (OpenCode Zen by default), grounded in the articles, FAQ articles and Kunena forum topics you choose. Optional light/dark theme, four viewport positions, welcome message and connection indicator."
5+
MOD_BEARSAMPPAI_XML_DESCRIPTION="Joomla 5.4/6 ready floating AI chat widget. Answers visitor questions through an OpenAI-compatible AI API (OpenRouter by default), grounded in the articles, FAQ articles and Kunena forum topics you choose. Optional light/dark theme, four viewport positions, welcome message and connection indicator."
66

77
; Content sources fieldset
88
MOD_BEARSAMPPAI_FIELDSET_CONTENT_LABEL="Knowledge Base Content"
@@ -19,13 +19,13 @@ MOD_BEARSAMPPAI_FIELDSET_AI_LABEL="AI Chat"
1919
MOD_BEARSAMPPAI_FIELD_SHOW_CHAT_LABEL="Show AI chat widget"
2020
MOD_BEARSAMPPAI_FIELD_SHOW_CHAT_DESC="Enable the AI-powered chat that answers questions using the article, FAQ and forum content you select as grounding context."
2121
MOD_BEARSAMPPAI_FIELD_AI_KEY_LABEL="AI API key"
22-
MOD_BEARSAMPPAI_FIELD_AI_KEY_DESC="API key for the AI service. With the default endpoint this is an OpenCode Zen key. Any OpenAI-compatible service works if you also change the endpoint and model. The key is only read on the server and is never sent to the browser."
22+
MOD_BEARSAMPPAI_FIELD_AI_KEY_DESC="API key for the AI service. With the default endpoint this is an OpenRouter key. Any OpenAI-compatible service works if you also change the endpoint and model. The key is only read on the server and is never sent to the browser."
2323
MOD_BEARSAMPPAI_FIELD_AI_MODEL_LABEL="AI model"
24-
MOD_BEARSAMPPAI_FIELD_AI_MODEL_DESC="Model your AI service should answer with. The default is big-pickle on OpenCode Zen. Use any model id the service accepts."
24+
MOD_BEARSAMPPAI_FIELD_AI_MODEL_DESC="Model your AI service should answer with. The default is qwen/qwen3.8-27b:free on OpenRouter. Use any model id the service accepts."
2525
MOD_BEARSAMPPAI_FIELD_AI_FALLBACK_MODEL_LABEL="Fallback model"
26-
MOD_BEARSAMPPAI_FIELD_AI_FALLBACK_MODEL_DESC="Model tried once if the primary request times out, is rate limited (HTTP 429) or returns a server error (HTTP 5xx). The default is space-bunny-free, a free OpenCode Zen model. Leave blank to disable fallback."
26+
MOD_BEARSAMPPAI_FIELD_AI_FALLBACK_MODEL_DESC="Model tried once if the primary request times out, is rate limited (HTTP 429) or returns a server error (HTTP 5xx). The default is google/gemma-4-31b-it:free, a free OpenRouter model. Leave blank to disable fallback."
2727
MOD_BEARSAMPPAI_FIELD_AI_ENDPOINT_LABEL="AI endpoint"
28-
MOD_BEARSAMPPAI_FIELD_AI_ENDPOINT_DESC="OpenAI-compatible chat completions endpoint. Leave the default for OpenCode Zen, or point it at any other compatible service."
28+
MOD_BEARSAMPPAI_FIELD_AI_ENDPOINT_DESC="OpenAI-compatible chat completions endpoint. Leave the default for OpenRouter, or point it at any other compatible service."
2929
MOD_BEARSAMPPAI_FIELD_MAX_TOKENS_LABEL="Max response tokens"
3030
MOD_BEARSAMPPAI_FIELD_TEMPERATURE_LABEL="Temperature"
3131
MOD_BEARSAMPPAI_FIELD_TIMEOUT_LABEL="Request timeout (seconds)"

‎language/en-GB/mod_bearsamppai.sys.ini‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
; Note: All translation files should be saved with UTF-8 encoding.
33

44
MOD_BEARSAMPPAI="Bearsampp AI"
5-
MOD_BEARSAMPPAI_XML_DESCRIPTION="Joomla 5.4/6 ready floating AI chat widget. Answers visitor questions through an OpenAI-compatible AI API (OpenCode Zen by default), grounded in the articles, FAQ articles and Kunena forum topics you choose. Optional light/dark theme, four viewport positions, welcome message and connection indicator."
5+
MOD_BEARSAMPPAI_XML_DESCRIPTION="Joomla 5.4/6 ready floating AI chat widget. Answers visitor questions through an OpenAI-compatible AI API (OpenRouter by default), grounded in the articles, FAQ articles and Kunena forum topics you choose. Optional light/dark theme, four viewport positions, welcome message and connection indicator."

‎mod_bearsamppai.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,23 @@
9494
type="text"
9595
label="MOD_BEARSAMPPAI_FIELD_AI_MODEL_LABEL"
9696
description="MOD_BEARSAMPPAI_FIELD_AI_MODEL_DESC"
97-
default="big-pickle"
97+
default="qwen/qwen3.8-27b:free"
9898
/>
9999

100100
<field
101101
name="ai_fallback_model"
102102
type="text"
103103
label="MOD_BEARSAMPPAI_FIELD_AI_FALLBACK_MODEL_LABEL"
104104
description="MOD_BEARSAMPPAI_FIELD_AI_FALLBACK_MODEL_DESC"
105-
default="space-bunny-free"
105+
default="google/gemma-4-31b-it:free"
106106
/>
107107

108108
<field
109109
name="ai_endpoint"
110110
type="text"
111111
label="MOD_BEARSAMPPAI_FIELD_AI_ENDPOINT_LABEL"
112112
description="MOD_BEARSAMPPAI_FIELD_AI_ENDPOINT_DESC"
113-
default="https://opencode.ai/zen/v1/chat/completions"
113+
default="https://openrouter.ai/api/v1/chat/completions"
114114
/>
115115

116116
<field

‎src/Helper/BearsamppaiHelper.php‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
* articles from the selected categories, FAQ articles read as
3636
* question/answer pairs, and Kunena forum topics.
3737
*
38-
* The default provider is OpenCode Zen (https://opencode.ai/zen/v1) running
39-
* `big-pickle`. Because the endpoint, key and model are all configurable, the
40-
* module is not tied to that provider: any OpenAI-compatible chat completions
41-
* service can be used by changing the four settings in the AI Chat tab.
38+
* The default provider is OpenRouter (https://openrouter.ai/api/v1) running a
39+
* free model variant. Because the endpoint, key and model are all configurable,
40+
* the module is not tied to that provider: any OpenAI-compatible chat completions
41+
* service can be used by changing the four settings in the AI Chat tab.
4242
*
4343
* The scope is the module's own configuration: `articles_category_id` (any of
4444
* the selected categories, or every published article when none is selected),
@@ -54,20 +54,20 @@
5454
class BearsamppaiHelper
5555
{
5656
/**
57-
* Default OpenAI-compatible endpoint (OpenCode Zen).
57+
* Default OpenAI-compatible endpoint (OpenRouter).
5858
*
5959
* @var string
6060
* @since 2.1.0
6161
*/
62-
private const DEFAULT_ENDPOINT = 'https://opencode.ai/zen/v1/chat/completions';
62+
private const DEFAULT_ENDPOINT = 'https://openrouter.ai/api/v1/chat/completions';
6363

6464
/**
6565
* Default model name.
6666
*
6767
* @var string
6868
* @since 2.1.0
6969
*/
70-
private const DEFAULT_MODEL = 'big-pickle';
70+
private const DEFAULT_MODEL = 'qwen/qwen3.8-27b:free';
7171

7272
/**
7373
* Default model tried when the primary model is rate limited, times out or
@@ -76,7 +76,7 @@ class BearsamppaiHelper
7676
* @var string
7777
* @since 2.3.0
7878
*/
79-
private const DEFAULT_FALLBACK_MODEL = 'space-bunny-free';
79+
private const DEFAULT_FALLBACK_MODEL = 'google/gemma-4-31b-it:free';
8080

8181
/**
8282
* Handle the com_ajax "ask" method.

‎updates.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<tags>
1414
<tag>ai</tag>
1515
<tag>chat</tag>
16-
<tag>opencode</tag>
16+
<tag>openrouter</tag>
1717
<tag>knowledgebase</tag>
1818
</tags>
1919
</update>

0 commit comments

Comments
 (0)