r/ZooCode • u/rossoow1 • 1d ago
Zoo Code (VS Code) loops on "Model Response Incomplete" with my local OpenAI-compatible gateway routing to Gemini/NVIDIA/Ollama models
I'm building a local gateway in FastAPI (uvicorn, port 8000) that exposes /v1/chat/completions in OpenAI format and routes requests to several providers through fallback chains: Gemini (gemini-3-flash-preview), NVIDIA NIM (550B-class models and others), and a local Ollama model (qwen2.5-coder:14b). I use Zoo Code (a VS Code extension) with the profile pointed at http://127.0.0.1:8000/v1, with custom modes like "Architect" and "Orchestrator."
Symptom: When I send an agentic task in Zoo (which sends tools and usually stream: true), the extension repeatedly shows Model Response Incomplete ("the model failed to use any tools in its response") and then Zoo is having trouble.... The tool is never executed.
What I've tested (with curl, directly against the gateway):
backendmode without tools: responds normally via Gemini, withcontentfilled in.architectmode with tools andstream: true: returnstool_callswithlist_filesfrom Gemini. This works after a streaming fix that makes the upstream call without streaming when tools are present and returns the result as SSE.- The Ollama model
qwen2.5-coder:14bcalled through the native API (/api/chat) with tools: it returns the tool call JSON as plain text insidecontent, without structuredtool_calls. So this model is not using tools in the expected format. maestromode with tools: previously, the gateway ignoredtoolsand returned text from an internal orchestrator (supervisor-worker) with notool_calls. After I routed these requests through the normal fallback chain, the test passed, but the first attempt took about 55 seconds (the timeout of the 550B model) before falling back to Gemini.
Current hypothesis: the Zoo profile sends orchestrator/maestro, which used to go to an internal flow without tool_calls. I have not yet confirmed this in the Zoo logs.
What I don't know yet:
- Whether Zoo really sends
stream: true, and the exact model name in the profile. - Why the chain doesn't move to the next model when a response is empty.
- Whether Zoo's default timeout is shorter than the fallback time.
Information I can share: excerpts from gateway/app.py (streaming and tool_calls handling), routing_config.json, the output of tail -n 60 logs/gateway.log right after a failure, and the Zoo mode configuration JSON (without API keys).
Question: Has anyone used Zoo Code (or Roo Code, which it is based on) with an OpenAI-compatible gateway and models without native tool-calling support? Is there a response format the extension expects that I should guarantee in streaming? Thanks.
2
u/p3rdy 1d ago
Your Ollama test already shows the main problem: if the tool call comes back as JSON inside
content, Zoo sees a text answer with notool_calls, which is exactly "the model failed to use any tools". Whichever provider ends up answering, the gateway has to hand Zoo structuredtool_calls, and there are three places where that breaks.1. Text tool calls from the local model. Either parse them in the gateway (look for a
{"name": ..., "arguments": ...}object or a<tool_call>...</tool_call>block incontentand move it intotool_calls), or never route requests that carrytoolsto a model that does this. Routing tool requests elsewhere is the simpler fix while you debug.2. The fake stream. When you call upstream without streaming and re-emit it as SSE, the chunks have to look like a real tool-call stream or the client's accumulator ends up empty:
The usual misses are the
indexon each tool call,argumentsas a string rather than an object, andfinish_reason: "tool_calls"on the last chunk.3. Empty answers and slow fallbacks. Treat "tools were sent, and the reply has neither
tool_callsnorcontent" as a failure and move to the next model in the chain, the same as an error. Give each provider a short time-to-first-response limit instead of one 55-second timeout, so the fallback happens before the client gives up.For the parts you don't know yet: log the incoming request body (
model,stream, how manytools) before routing. One failed run will show what the profile really sends.For the local leg specifically: I maintain Flama, an open-source Python framework that can serve the model itself instead of Ollama, on MLX or vLLM. It detects the model's tool-call format when it warms up and returns proper
tool_callson its OpenAI-compatible endpoint, so your gateway would get structured calls from that leg instead of having to parse them.