openai configuration to AnythingLLM API doesn't show response tokens
Before submitting your bug report
- [ ] I've tried using the "Ask AI" feature on the Continue docs site to see if the docs have an answer
- [x] I'm not able to find a related conversation on GitHub discussions that reports the same bug
- [x] I'm not able to find an open issue that reports the same bug
- [x] I've seen the troubleshooting guide on the Continue Docs
Relevant environment info
- OS: Windows 11
- Continue version: 1.2.22
- IDE version: 1.124.2
- Model: OpenAI (AnythingLLM API)
- config:
- name: AnythingLLM NPU Phi3.5 3.8B 4K
provider: openai
apiKey: APIKEY
model: vscode
env:
useLegacyCompletionsEndpoint: false
apiBase: http://localhost:3001/api/v1/openai
roles:
- chat
- edit
- apply
defaultCompletionOptions:
contextLength: 4096
temperature: 0.2
maxTokens: 2048
Description
When I use the OpenAI provider along with the AnythingLLM API, responses are not shown within the chat window. Responses are being generated and chunked data is being returned as viewed within a packet capture. Other models via Ollama work fine and provide responses. A quick comparison of network traffic shows that the response data from Ollama matches that of the AnythingLLM API. Example response from the API:
POST /api/v1/openai/chat/completions HTTP/1.1
accept: application/json
accept-encoding: gzip, deflate, br
authorization: Bearer APIKEY
content-length: 1998
content-type: application/json
user-agent: OpenAI/JS 5.23.2
x-stainless-arch: arm64
x-stainless-lang: js
x-stainless-os: Windows
x-stainless-package-version: 5.23.2
x-stainless-retry-count: 0
x-stainless-runtime: node
x-stainless-runtime-version: v24.15.0
Host: 127.0.0.1:3001
Connection: close
{"messages":[{"role":"system","content":"<important_rules>\n You are in chat mode.\n\n If the user asks to make changes to files offer that they can use the Apply Button on the code block, or switch to Agent Mode to make the suggested updates automatically.\n If needed concisely explain to the user they can switch to agent mode using the Mode Selector dropdown and provide no other details.\n\n Always include the language and file name in the info string when you write code blocks.\n If you are editing \"src/main.py\" for example, your code block should start with '```python src/main.py'\n\n When addressing code modification requests, present a concise code snippet that\n emphasizes only the necessary changes and uses abbreviated placeholders for\n unmodified sections. For example:\n\n ```language /path/to/file\n // ... existing code ...\n\n {{ modified code here }}\n\n // ... existing code ...\n\n {{ another modification }}\n\n // ... rest of code ...\n ```\n\n In existing files, you should always restate the function or class that the snippet belongs to:\n\n ```language /path/to/file\n // ... existing code ...\n\n function exampleFunction() {\n // ... existing code ...\n\n {{ modified code here }}\n\n // ... rest of function ...\n }\n\n // ... rest of code ...\n ```\n\n Since users have access to their complete file, they prefer reading only the\n relevant modifications. It's perfectly acceptable to omit unmodified portions\n at the beginning, middle, or end of files using these \"lazy\" comments. Only\n provide the complete file when explicitly requested. Include a concise explanation\n of changes unless the user specifically asks for code only.\n\n</important_rules>"},{"role":"user","content":"Hey there, just testing. Are you able to help me code?"},{"role":"user","content":"Sorry, I don't seem to be getting any output from you."}],"model":"vscode","max_tokens":4096,"stream":true,"stream_options":{"include_usage":true}}
HTTP/1.1 200 OK
X-Powered-By: Express
Vary: Origin
Cache-Control: no-cache
Content-Type: text/event-stream
Access-Control-Allow-Origin: *
Connection: keep-alive
Date: Sun, 14 Jun 2026 19:24:27 GMT
Transfer-Encoding: chunked
data: {"id":"79755aff-21d8-4dca-8cce-462b39304594","object":"chat.completion","created":1781465068,"model":"vscode","choices":[{"index":0,"delta":{"role":"assistant","content":"No"},"logprobs":null,"finish_reason":null}],"usage":{}}
data: {"id":"79755aff-21d8-4dca-8cce-462b39304594","object":"chat.completion","created":1781465069,"model":"vscode","choices":[{"index":0,"delta":{"role":"assistant","content":" worries"},"logprobs":null,"finish_reason":null}],"usage":{}}
The output console shows 0 tokens returned and the logs show no errors related to responses.
To reproduce
- Install AnythingLLM and set up a Workspace connected to an LLM.
- Enable the AnythingLLM API and create an API key.
- Configure a new model on Continue to point to the AnythingLLM API along with the API key.
- Create a new chat and send the message.
- Review the console output and check the response tokens to confirm 0.
Log output
Since you confirmed via packet capture that response chunks ARE being returned with correct data, the issue is in how Continue's OpenAI provider parses the streaming response from AnythingLLM — not a server-side problem.
Most likely cause: SSE content-type or chunk format mismatch
AnythingLLM's OpenAI-compatible endpoint may return chunks in a slightly different format than what the OpenAI JS SDK expects. Common differences:
-
Missing
content-type: text/event-streamheader — if AnythingLLM returnsapplication/jsoninstead, the OpenAI SDK won't parse the response as SSE and may silently discard the body. -
Chunk delimiter format — the OpenAI streaming spec requires
data: {...}\n\n(double newline). Some local backends usedata:{...}\n(single newline, no space afterdata:). The OpenAI SDK is strict about this format. -
[DONE]sentinel — the stream must end withdata: [DONE]\n\n. If AnythingLLM omits this or sends it differently, the SDK may wait indefinitely for more data and never flush the accumulated content.
Debugging:
Compare the raw SSE output between Ollama (working) and AnythingLLM (broken):
# AnythingLLM raw SSE
curl http://localhost:3001/api/v1/openai/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_KEY" \
-d '{"model":"vscode","messages":[{"role":"user","content":"hi"}],"stream":true}' \
--no-buffer 2>&1 | head -20
# Compare with Ollama raw SSE
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL","messages":[{"role":"user","content":"hi"}],"stream":true}' \
--no-buffer 2>&1 | head -20
Check: are the response headers identical? Are the data: line formats the same? Does both end with data: [DONE]?
If the format differs, an OpenAI-compatible API gateway between AnythingLLM and Continue can normalize the SSE output to strict OpenAI format, which avoids SDK parsing issues.
OpenAI-compatible endpoint configuration checklist: https://futurmix.ai/docs/integration-guide?utm_source=github&utm_medium=issue_reply&utm_campaign=continue
Disclosure: I work on FuturMix, an OpenAI-compatible API gateway, and put together these docs while debugging similar SSE compatibility issues. Sharing in case it helps.
The Content-Type is being returned as text/event-stream, and there are two new line characters after each data: element (confirmed at byte level). It does not return the data: [DONE], but a finish_reason is provided.
As for comparing the two, Ollama is using a different backend so the returned format is different. The content type is application/x-ndjson.