Tabbit
ResourcesBlogModels
Tabbit LogoTabbit

Tabbit — The AI Browser that Works for You

Topics

  • AI Browser Resources
  • Agentic Browser Resources
  • Browser Downloads and Install Guides
  • Browser Comparisons
  • AI Browser Alternatives
  • Browser Productivity Resources

Popular Guides

  • AI Browser
  • Agentic Browser Download
  • Best AI Browser 2026: Top 9 Tested & Ranked
  • AI Browser Download
  • Free AI Browser
  • Best AI Browser 2026
  • AI Browser Comparison 2026
  • AI Browser for Windows
  • AI Browser for Mac
  • Chrome Alternative 2026

Events

  • Tabbit Skill Competition
  • KPOP SBTI Fandom Personality Test
  • Tabbit Campus Creator Program
  • fifi's Picks: AI Skills for Research Papers
  • User Survey

About

  • Tabbit Blog
  • Press & Media
Prompt guide
CommunityQwen3.7 Max

Qwen3.7-Max: OpenCode Cache Configuration and Agent Guardrails

Original source

Reddit (r/opencodeCLI & r/QwenAI )

AuthorUnableStrategy, SimplyValueInvesting, DeepAd1959

Source date2026-05-25

Tabbit curation2026-08-20

Read original

One-sentence takeaway

When integrating Qwen3.7-Max via OpenRouter in OpenCode CLI or similar agent frameworks, you must explicitly pass context-caching request headers through the @ai-sdk/alibaba adapter layer and avoid unbound indirect tool rules in AGENTS.md to prevent single-session token runaways exceeding 8M+ tokens.

Use cases

  • Suitable tasks: Running Qwen3.7-Max for code engineering and complex refactoring via OpenCode CLI, Claude Code, or custom agent architectures.

  • Unsuitable tasks: Allowing the model to autonomously invoke high-frequency CLI tools without cache configuration or in an unobservable environment.

  • Applicable model versions: qwen/qwen-3.7-max (OpenRouter alias ) or Alibaba Cloud official qwen3.7-max.

  • Applicable clients, agents, or APIs: OpenCode CLI, Claude Code compatibility layer, OpenRouter API, and DashScope API.

  • Recommended reasoning levels and parameters: Place a fixed prefix at the top of the system prompt to enable Prompt Caching, and disable open-ended, non-strict matching instructions.

Ready-to-use content

1. opencode.json configuration to enable OpenRouter context caching in OpenCode CLI

{
  "provider": {
    "openrouter-cached": {
      "npm": "@ai-sdk/alibaba",
      "name": "OpenRouter (Cached)",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "YOUR_OPENROUTER_API_KEY"
      },
      "models": {
        "qwen/qwen-3.7-max": {
          "name": "Qwen 3.7 Max"
        }
      }
    }
  }
}

2. Agent specification template ( AGENTS.md ) to prevent repetitive context rewrites and token runaways with Qwen3.7-Max

# Agent Execution Guardrails for Qwen3.7-Max

## Core Execution Rules
1. Tool Invocation Mapping:
   - When reading repository context, use ONLY the exact registered tool name `grep_search` or `view_file`.
   - Do NOT delegate tool actions to external secondary LLMs unless explicitly invoked via verified MCP endpoint.

2. Context Conservation:
   - Do NOT re-read or dump unmodified configuration files on every iteration.
   - For file modifications, output precise diff chunks instead of whole-file rewrites.

3. Negative Constraints & Deletion Protection:
   - "Disable feature" MUST be interpreted as disabling logic (e.g., commenting out, flipping boolean flags, or setting feature toggle to false).
   - NEVER execute `rm`, `unlink`, or delete files/routes unless the prompt explicitly contains the word "DELETE" or "REMOVE".
   - If unsure between disabling vs deleting, STOP and ask the user for confirmation.

Testing/workflow steps

  1. Configure the provider in opencode.json as an OpenRouter alias with the @ai-sdk/alibaba adapter to ensure requests pass through cache-hit headers.

  2. Audit all directives in AGENTS.md / CLAUDE.md: ensure every tool name referenced by a rule matches the model's actual callable tool list verbatim (Verbatim matching ).

  3. Run a small-scale test: execute 3 code retrieval and modification interactions, and monitor via proxy logs whether input tokens grow linearly on each turn (uncached ) or only increase by deltas (cache hit ).

  4. Monitor Time to First Token (TTFT ) and output token generation speed across multi-turn conversations; immediately trigger an Early Stop if the model repeatedly re-interprets specifications or enters tool-invocation loops.

Original evidence and data

  • Empirical test log by community user Unable_Strategy: using the standard OpenRouter configuration to call Qwen3.7-Max directly in OpenCode CLI consumed $4.00 in API credits within 8 minutes (134 requests generating 8,236,560 input tokens and 40,903 output tokens ) because the entire project context was reloaded on every interaction without hitting the cache.

  • Debugging revealed that OpenCode CLI's cache-header injection relies on SDK detection; specifying npm: "@ai-sdk/alibaba" successfully activates server-side Prompt Caching, dramatically cutting repetitive input token costs.

  • Architectural analyst Deep_Ad1959 pointed out: when the Qwen3 series parses multi-layered natural language agent rules, if tool descriptions in instructions do not match the actually provided Tool Schema verbatim, the model tends to degrade instructions into open-ended rewrites, triggering long-context loops.

Scope and limitations

  • This configuration relies on the Prompt Caching implementation of OpenRouter and Alibaba-compatible endpoints; third-party private proxies will not work if they do not support cache-header passthrough.

  • Rule-based constraints reduce the probability of unintended operations, but extremely complex negative instructions (such as configuration changes containing double negatives ) still require sandboxing and human-in-the-loop confirmation mechanisms.

Source excerpt or observation (brief excerpt for compliance only )

A core community discussion noted: "8.2M input on 3 prompts is the agent.md getting re-read with most of the repo on every turn... grep your agent.md for every directive that depends on a tool name, and check if that tool name appears verbatim".

Curated by Tabbit

Prompt material is summarized from public sources and Tabbit editorial notes. Check the original licensing and intended use before copying it.

Qwen3.7 Max

Use in Tabbit

Qwen3.7 Max

Related prompts

MediaQwen official blog2026-05-20

Qwen3.7-Max: Long-Horizon Agents, Frontend Prototypes, and Office Prompts

MediaAlibaba Cloud Model Studio2026-08-18

Qwen3.7-Max: Alibaba Cloud Model Studio Versions, Pricing, and Cache Configuration

CommunityX.com & GitHub Community2026-08-08

Qwen3.7-Max: Multi-Model Collaborative Routing Configuration for Code Reading and Review

CommunityAlibaba Cloud & Tongyi Lab (Tongyi Lab)2026-06-11

Qwen3.7-Max: Three.js Electronic Rubik's Cube and 3D Physics Interaction Prototype Prompt

Qwen3.7 Max

Related reviews

MediaQwen official blog2026-05-20

Qwen3.7-Max: Official Complete Benchmarks and 35-Hour Autonomous Optimization Experiment

MediaBenchLM.ai2026-05-16

Qwen3.7-Max: BenchLM Public Evidence Coverage and Speed Ledger

MediaOfox AI2026-06-02

Qwen3.7-Max vs. Qwen3.7-Plus: Cost and Quality on Three Real Tasks

MediaArtificial Analysis2026-05-20

Qwen3.7-Max: Artificial Analysis Intelligence Index, Cost, and Speed Benchmark