Environment:
Junie CLI Version: v.26.6.22
OS: Windows (running via PowerShell)
Endpoint: Custom OpenAI-compatible gateway
Configuration: Custom BYOK model via ~/.junie/model/*.json
Description:
When configuring the Junie CLI to connect to a custom OpenAI-compatible API using "apiType": "OpenAICompletion", the CLI fails to execute tasks if the server responds with a Server-Sent Events (SSE) stream.
Instead of processing the stream chunks, Junie attempts to parse the entire incoming stream as a single JSON object. When it encounters the standard data: prefix of the SSE stream, the JSON parser fails and the task is immediately stopped. Adjusting the "stream" parameter in the configuration JSON (both explicitly setting it to true and removing it entirely) does not change this behavior.
Steps to Reproduce:
Create a custom model configuration file in ~/.junie/model/gemini-3.1-pro-preview.json with the following content:
{
"baseUrl": "https://<REDACTED>/v1/chat/completions",
"apiKey": "<REDACTED>",
"apiType": "OpenAICompletion",
"id": "gemini-3.1-pro-preview",
"primaryModel": {
"id": "gemini-3.1-pro-preview"
},
"fasterModel": {
"id": "gemini-3.5-flash"
}
}
Reference this model in ~/.junie/config.json:
{
"model": "gemini-3.1-pro-preview"
}
Start Junie and issue a prompt (e.g., > update my readme.md).
Expected Behavior:
Junie should either correctly parse the data: {...} SSE stream chunks returned by the OpenAI-compatible endpoint, OR it should explicitly pass "stream": false in the request payload to ensure the server returns a standard, non-streaming JSON response.
Actual Behavior:
The task fails immediately with the message: The task was stopped due to an error. Try again.
Error Logs:
The Junie session logs reveal a parsing exception where the JSON parser hits the 'd' in data::
com.intellij.ml.llm.matterhorn.LLMBadResponseException: Can not parse response. Error: Unexpected JSON token at offset 0: Expected start of the object '{', but had 'd' instead at path: $
JSON input: data: {"choices":[{"delta":{"c.....
Environment:
Junie CLI Version: v.26.6.22
OS: Windows (running via PowerShell)
Endpoint: Custom OpenAI-compatible gateway
Configuration: Custom BYOK model via ~/.junie/model/*.json
Description:
When configuring the Junie CLI to connect to a custom OpenAI-compatible API using "apiType": "OpenAICompletion", the CLI fails to execute tasks if the server responds with a Server-Sent Events (SSE) stream.
Instead of processing the stream chunks, Junie attempts to parse the entire incoming stream as a single JSON object. When it encounters the standard data: prefix of the SSE stream, the JSON parser fails and the task is immediately stopped. Adjusting the "stream" parameter in the configuration JSON (both explicitly setting it to true and removing it entirely) does not change this behavior.
Steps to Reproduce:
Create a custom model configuration file in ~/.junie/model/gemini-3.1-pro-preview.json with the following content:
Reference this model in ~/.junie/config.json:
Start Junie and issue a prompt (e.g., >
update my readme.md).Expected Behavior:
Junie should either correctly parse the data: {...} SSE stream chunks returned by the OpenAI-compatible endpoint, OR it should explicitly pass "stream": false in the request payload to ensure the server returns a standard, non-streaming JSON response.
Actual Behavior:
The task fails immediately with the message:
The task was stopped due to an error. Try again.Error Logs:
The Junie session logs reveal a parsing exception where the JSON parser hits the 'd' in data::