19 yesterday

cloud
ollama run igovet/deepseek-v4-flash-new-opencode

Models

View all →

Readme

DeepSeek V4 Flash (New) — OpenCode (Ollama Cloud)

Modelfile & provider preset tuned for stable work inside OpenCode over Ollama Cloud, built on the official deepseek-v4-flash:0731-cloud release.


Background

This modelfile wraps the official DeepSeek-V4-Flash-0731 build (deepseek-v4-flash:0731-cloud, published July 31, 2026) on Ollama Cloud. It supersedes the earlier deepseek-v4-flash:cloud preview with a post-training refresh focused on substantially enhanced agentic capabilities — which is exactly the OpenCode use-case. Architecture and size are unchanged (284B MoE / 13B activated, native 1M context).

When using Ollama Cloud models from OpenCode, several issues surface out of the box:

  • Stream stalls — the response repeatedly pauses mid-token.
  • Stream freezes → timeout — long stalls trip the upstream timeout.
  • Same issues on plain HTTP — disabling streaming does not make them go away.
  • Reasoning loops — some models (notably DeepSeek) get stuck inside their own reasoning trace and never escape.
  • Hard output cap — Ollama Cloud rejects num_predict above 65,536 with an HTTP 400, despite the model’s published 384K native output.

The settings below were arrived at empirically and raise the stability of Ollama Cloud + OpenCode to roughly 95%. The remaining edge cases look like Ollama Cloud throughput / model overload bugs, not configuration problems.

⚠️ These settings are experimental. They are not endorsed by Ollama or DeepSeek — they are what happened to work best in our environment.


TL;DR

Field Value
Base model deepseek-v4-flash:0731-cloud
Context window 1048576
Output limit (in OpenCode) 384000
Temperature 1.0
Top-p 0.95 (agentic scenarios)
Repeat penalty 1.1 (last 2048 tokens)
Variants max / high / medium / low / none

Modelfile

FROM deepseek-v4-flash:0731-cloud

PARAMETER num_ctx 1048576
PARAMETER num_predict 16384
PARAMETER temperature 1.0
PARAMETER top_p 0.95
PARAMETER repeat_penalty 1.1
PARAMETER repeat_last_n 2048

num_predict is kept at 16384 for parity with the existing flash preset and to stay well under Ollama Cloud’s enforced 65,536 ceiling. top_p is set to 0.95, matching DeepSeek’s recommendation for agentic scenarios. repeat_penalty 1.1 / repeat_last_n 2048 are the project’s empirical defaults (DeepSeek publishes no official values for these).


OpenCode configuration

The model is registered under the ollama provider using the real opencode.json block shape: variants as an array of { id, settings } entries and output: 384000.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama",
      "options": {
        "baseURL": "http://localhost:11434/v1",
        "timeout": 1200000,
        "headerTimeout": 1200000
      },
      "models": {
        "igovet/deepseek-v4-flash-new-opencode": {
          "_launch": false,
          "name": "DeepSeek V4 Flash (New OpenCode)",
          "limit": {
            "context": 1048576,
            "output": 384000
          },
          "variants": [
            { "id": "max", "settings": { "reasoningEffort": "max" } },
            { "id": "high", "settings": { "reasoningEffort": "high" } },
            { "id": "medium", "settings": { "reasoningEffort": "medium" } },
            { "id": "low", "settings": { "reasoningEffort": "low" } },
            { "id": "none", "settings": { "reasoningEffort": "none" } }
          ],
          "capabilities": {
            "tools": true,
            "input": ["text"],
            "output": ["text"]
          }
        }
      }
    }
  }
}

Notes

Why output is set where it is

Ollama does not honor a separate output (max output tokens) reliably through the OpenAI-compatible surface that @ai-sdk/openai-compatible speaks to. At the same time, Ollama Cloud hard-rejects any client that sends a full 1M output budget (HTTP 400 — max_tokens exceeds the model's maximum output tokens (65536)). The registration uses output: 384000, which is the model’s published native output ceiling, while num_predict stays at 16384 in the modelfile to keep streams well under the enforced cloud cap and avoid mid-response clipping.

Long timeouts

timeout and headerTimeout are bumped to 20 minutes (1200000 ms). Cloud models occasionally queue for several minutes during peak load, and the default AI SDK timeouts will fire long before that.


Reasoning effort — when to pick what

The 0731 build natively supports three reasoning levels — low, high, and max (plus an off state); medium is not a native DeepSeek level. Two practical constraints shape what’s exposed in OpenCode:

  1. reasoning_effort is the only accepted spelling on the OpenAI-compatible surface (snake_case-only — the camelCase variant is silently dropped).
  2. max thinking is a cloud-only capability: reasoning_effort: "max" works on Ollama Cloud but is rejected on local Ollama (invalid think value: "max"), which maps max → high instead.

So the OpenCode variants map as:

OpenCode variant reasoning_effort sent Ollama behavior
max max Maximum reasoning — cloud only; rejected on local Ollama.
high high The strongest practical tier — treated as max behavior on cloud.
medium medium Coerced client-side; not a native DeepSeek level (balanced depth/latency).
low low Shallow reasoning, fastest output.
none none Reasoning disabled entirely.

Recommended use inside OpenCode:

  • high (or max on cloud) — multi-step delegation, architecture review, debugging subtle bugs across files. Use when the orchestrator agent is the one driving; this is the strongest practical reasoning tier.
  • medium — sub-agents (backend-developer, frontend-developer, refactorer) doing concrete edits on a known scope; note it is a non-native coercion of the model’s effort.
  • lowqa-engineer, code-reviewer, security-auditor on small diffs.
  • none — fast inline completions / classification (rarely worth it for a reasoning model).

For agentic work in particular, this preset also sets top_p: 0.95 to match the sampling configuration DeepSeek used for its own agent benchmark runs.