Deep research
Add deep_research: true to a normal completion. The proxy runs the same loop as Chat: it plans several searches, reads public pages, and then asks your model for a cited report.
curl https://api.proxy.gonka.gg/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key-here" \
-d '{
"model": "deepseek-ai/DeepSeek-V4-Flash-0731",
"deep_research": true,
"messages": [
{"role": "user", "content": "What moved Brent crude prices in 2026?"}
]
}'Without stream, the call still returns one chat completion. The proxy writes a newline immediately and another every 5 seconds while the research runs, then the JSON body. Those newlines are ignored by JSON parsers.
With stream: true, the same connection sends the research loop first, then the report.
Streaming
Progress is an SSE comment, so OpenAI SDKs skip it and still parse the report. Each comment starts with : research and then JSON:
: research {"type":"research","stage":"search","detail":"Searching the web","pass":1,"done":1,"total":4,"elapsed_ms":1200,"eta_ms":90000}
: research {"type":"research_jev","query":"brent crude forecast 2026","decisions":[{"title":"Brent crude forecast","url":"https://example.com","score":0.91,"kept":true}]}
: research {"type":"tool_call","name":"web_search","query":"brent crude forecast 2026","count":1,"results":[],"detail":""}stage is plan, search, judge, deepen, read, or write. A : heartbeat comment is sent every 5 seconds until the report starts.
The report follows as normal chat completion chunks and ends with data: [DONE]. To print the loop, read the raw stream and parse lines that start with : research . The OpenAI SDK yields only the report.
If the loop fails after the stream has started, the proxy sends data: {"type":"error","error":"..."} and then data: [DONE]. The HTTP status stays 200.
This section is the public API. Chat uses data: events for the same stages, and that job keeps running after the page closes. See below.
Chat
Deep research started in Chat is a backend job. The open page is only a live view.
- Closing the tab, refreshing, or losing the connection does not cancel it.
- Open the same chat again. The sidebar says Researching, and the thread shows the latest stage (
plan,search,judge,deepen,read, orwrite). - The finished report is saved as the assistant message. That chat does not take another message until the run finishes.
- A proxy restart interrupts a run that is still going. The thread says so, and you can send it again.
POST /v1/chat/completions stays on its HTTP connection. If that client disconnects, the API research stops. Only Chat keeps working after the page is gone.
While the Chat page is open it reads SSE data: events:
data: {"type":"research","stage":"search","detail":"Searching the web","pass":1,"done":1,"total":4,"elapsed_ms":1200,"eta_ms":90000}
data: {"type":"research_jev","query":"brent crude forecast 2026","decisions":[{"title":"Brent crude forecast","url":"https://example.com","score":0.91,"kept":true}]}
data: {"type":"tool_call","name":"web_search","query":"brent crude forecast 2026","count":1,"results":[],"detail":""}A : heartbeat comment still arrives every 5 seconds until the report starts. The report is normal completion chunks. You do not need to keep this stream open: the server writes the message when the report is done.
Timeouts
Keep a total timeout of at least 5 minutes. Both modes send bytes within the first second and then at least every 5 seconds, so a 60-second idle limit does not drop the connection. stream: true uses SSE comments (: heartbeat). Without stream, the keepalives are newlines before the JSON body.
client = OpenAI(
base_url="https://api.proxy.gonka.gg/v1",
api_key="sk-your-api-key-here",
timeout=300,
)curl --max-time 300 https://api.proxy.gonka.gg/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key-here" \
-d '{
"model": "deepseek-ai/DeepSeek-V4-Flash-0731",
"deep_research": true,
"stream": true,
"messages": [
{"role": "user", "content": "What moved Brent crude prices in 2026?"}
]
}'SDK note
OpenAI SDKs may drop unknown keys. Put the flag in extra_body:
client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4-Flash-0731",
messages=[{"role": "user", "content": "What moved Brent crude prices in 2026?"}],
extra_body={"deep_research": True},
)Pseudo-tool
Clients that can only send a tools array may pass {"type":"deep_research"}. The proxy consumes it and does not forward that tool upstream.
Cost
You are billed for the tokens of the model you named: the planning calls and the final report, at that model's rate. Search itself is not a separate line item.
Jev judges which pages to keep. That use is internal to the loop, the same way Chat does it. It is not billed, and it does not require the 100,000,000-token eligibility that a direct Jev call requires. Do not send jev as the model. Jev does not write the report.
What it does not combine with
web_search on the same request is ignored. Deep research does its own searches. MCP tools on the same request are not called.