RAPTORCODE Docs

Reference

Models and the DeepSeek API

The DeepSeek models RaptorCode supports, the request settings it sends, and how it handles finish reasons, errors, retries and the context window.

RaptorCode talks to the official DeepSeek API directly, using its OpenAI-format endpoints:

EndpointUsed for
POST https://api.deepseek.com/chat/completionsChat, streaming and agent tool turns
GET https://api.deepseek.com/modelsThe /model picker and the startup key check
GET https://api.deepseek.com/user/balance/balance and the first-run key check

#Models

API nameModelNotes
deepseek-v4-proDeepSeek V4 ProDefault. Text only.
deepseek-flashDeepSeek V4.1 FlashFaster and cheaper; accepts images.

Both have a 1,048,576-token context window (prompt plus output), up to 393,216 output tokens (384K), tool calls, JSON output and thinking mode with low, high and max effort.

Retired names are mapped before a request is sent: deepseek-v4-flash, deepseek-v4-flash-vision-exp, deepseek-chat and deepseek-reasoner all become deepseek-flash. Any other id is sent unchanged.

#Request settings

thinking default: enabled

Thinking mode is on by default. /thinking switches it off and back on.

reasoning effort default: max in the REPL, swarm and run; high in chat and planning

/effort cycles low → high → max; raptor run takes --effort.

max_tokens default: 131072

Every generation allows 128K output tokens, so a large write_file call is not cut off mid-argument. Output is billed as generated, so the larger budget costs nothing by itself.

stream default: on

On by default in the REPL, always on for swarm agents and raptor run. Streamed requests ask for usage with stream_options: {"include_usage": true}.

response_format default: text

/json sends {"type": "json_object"} and a system instruction asking for JSON, as DeepSeek requires.

temperature, top_p and penalties are not sent: thinking mode ignores them, and DeepSeek’s defaults are what its own agent evaluations use.

#Thinking mode and tool calls

When a request carries tools, DeepSeek requires the reasoning content of every earlier assistant turn to be sent back. RaptorCode keeps it on every assistant message and replays it, and never appends an assistant message of its own making, so typing continue after the step limit works.

#Finish reasons

finish_reasonWhat the agent loop does
stop, tool_callsNormal end of a step.
length with textKeeps the answer and asks the model to continue where it stopped (up to 3 times in a row).
length with tool callsRuns the complete calls; a call cut off mid-arguments is not run, and the model is told to send smaller pieces.
insufficient_system_resource, abortedRecords nothing and resends the request (up to 2 times), then reports the interruption.
content_filterReturns the answer with a note that DeepSeek’s content filter stopped it.

#Errors and retries

StatusHandling
400, 422Not retried; DeepSeek’s message is shown.
401, 403Not retried; the REPL offers to re-enter the key without losing history.
402Not retried; the message points to the top-up page.
429, 503Up to 5 attempts with exponential backoff (1 s base, 60 s cap, 25% jitter); Retry-After is honoured up to 120 s.
500, 502, 504, network errorsUp to 3 attempts with the same backoff.
200 with an error objectReported as a generation failure and retried by the agent loop.

On top of that, the agent loop resends a step that failed for a transient reason up to 5 more times over about two minutes, showing each retry in the REPL and on the dashboard. Nothing from a failed attempt enters the history.

The HTTP client allows 15 s to connect. For streamed requests, the 600 s timeout bounds the wait for headers and for each read, not the whole stream, so long thinking steps are fine.

#Context budget

The API is stateless, so RaptorCode keeps the history locally and sends it with each request. After each tool round, it estimates the next prompt size:

  • at 720K tokens it warns once;
  • at 786,432 tokens (75% of the window) it compacts: it keeps the system prompt, the original task or mission, a marker saying how many messages were dropped, and the most recent messages. A tool result is never separated from the turn that requested it.

That leaves room for the 128K output budget plus a round of tool results inside the window.

#Context caching

DeepSeek caches prompt prefixes automatically. Because RaptorCode only appends to a conversation (compaction aside), later requests reuse the cached prefix. The REPL shows the context size and the cache-hit share, and raptor run prints input, cached and output token totals.

#Not used

  • Strict tool mode (beta) needs the beta base URL and schemas with every property required. It may be added as an option.
  • Server-side web tools run outside the local tool policy, so agents don’t declare them.
  • Chat prefix completion and fill-in-the-middle (beta) are not used.