Why a 1M-Context LLM Only Gets 200K in AI Coding Tools: The Silent Degradation Caused by Client-Side Context Assumptions

    This article explains why AI coding tools often use far less of an LLM’s advertised context window than expected. Through a mock-server test, it shows how an unknown model name can trigger a hardcoded 200K context assumption, auto-compaction, and a silent loss of usable context. It then analyzes the engineering reasons behind the client-side design and offers practical ways for developers and gateway operators to detect and avoid the issue.

    Many developers have encountered a similar problem: they connect a model that claims to support a 1M-token context window, but when a long session in an AI coding tool reaches around 100K to 200K tokens, the model starts to “forget” things. Code conventions and file structures discussed earlier gradually disappear. After checking the model service side, everything looks normal. The real culprit is often the client-side “context window assumption.” This article uses an actual test from gateway development to break down this typical silent degradation issue.

    1. Symptom: Usable Context Is Much Smaller Than Advertised

    There is a phenomenon you can verify in about half a minute. In a coding tool that can display context usage, if you are not using the official built-in model but have connected a third-party model through a custom endpoint—such as various open-source LLMs or gateway services—the context statistics usually show something like this at the top:

    1. ## Context Usage
    2. Tokens: 2k / 200k (1%)

    Note that the denominator is 200k. If the model you connected actually claims a 1M context window, this means 83% of the window has never been used. The bigger problem is that this process does not report an error or interrupt the session. It only shows up as “why does the model keep forgetting things?”

    While working on model gateway integration, I ran into this pitfall. I reviewed the client’s window determination logic in full and verified each point with a local mock server. The conclusions below all come from actual reproduction, and readers can verify them in the same way.

    2. Test: Same Model, 6x Difference in Available Space

    The test method is simple: start a local mock server, take over the client’s API address variable, then pass in different model names and observe the context usage reported by the tool. The results are as follows:

    Model name passed in Context display Available space Compression reserve
    A model (plain name) 2k / 200k 165k 33k
    A model (with 1M suffix) 2k / 1m 998k None

    Available space jumped from 165k to 998k—a full 6x increase. Note that it is not 5x: the window itself has a 5x relationship from 200k to 1m, but the 200k side also has a 33k reserve deducted. This 33k consists of two hard-coded constants: 20,000 reserved for model output plus a fixed buffer of 13,000, totaling 33,000, which matches the panel display exactly.

    With the 1M marker, the reserved buffer no longer takes effect, and almost the entire window becomes available. This shows that the client uses a different resource management strategy for “large-window models.”

    3. Root Cause: Why the Client Does Not Recognize Your Model

    The core issue is that the client does not recognize your model name.

    Mainstream coding tools maintain an internal model-window mapping table that records the context window size for each known model. When they encounter a name that is not in the table, they do not call an API to query “how large are you actually?” Instead, they conservatively assume a default value: 200,000 tokens. This number is hardcoded in the code.

    The tool then uses this assumed value to trigger auto-compact: when the session length approaches the assumed window minus the reserved buffer, it automatically compresses the conversation history into a summary to free up space and continue working.

    For unknown models, the client does give a warning. It roughly says: “This model name cannot be recognized by the current version. Auto-compact will keep the session within 200k tokens (the assumed window). If the model actually supports a larger window, append a 1M marker to the model name to enable 1M context.”

    The problem is that this warning appears only once at session startup, mixed into a pile of startup logs. The vast majority of developers will not notice it. After that, everything runs normally: no error, no interruption, just history compression starting after 100K+ tokens. You might blame the model for having a poor memory, but the problem lies in the client’s window assumption.

    This is a typical case of silent degradation: no part of the chain proactively tells you that 83% of the 1M context you paid for has never participated in the work.

    4. Why the Client Makes This Decision for You

    From an engineering perspective, this design has its rationale, but it also creates hidden risks:

    1. Defensive default value. If the client made no window assumption for unknown models and simply sent requests according to the size claimed by the user, then once the model’s actual window is smaller, the request would hit a context-overflow error on the server and could even crash the session. Conservatively assuming 200k is a “rather underuse than exceed” strategy.

    2. No dynamic probing. Most current model inference APIs do not provide a metadata endpoint for querying their own context window. The client can only obtain the window size through a whitelist or user hints. This is a protocol-level gap.

    3. Necessity of the reserved buffer. Reserving output space and a compaction buffer is reasonable—without leaving room for model output, long responses may trigger truncation; the compaction buffer ensures that the compaction action itself has room to operate. But in large-window scenarios, these fixed constants designed for small windows should scale proportionally, yet they are simply removed. This indicates that the logic is adapted per “known model” rather than being a generic formula.

    5. How Developers Can Identify and Avoid the Issue

    Based on the test experience, here are some practical recommendations:

    1. Actively verify window utilization. Regularly check the tool’s context statistics panel and confirm whether the denominator matches the model’s advertised window. If the denominator is clearly too small, the client is making a window assumption.

    2. Watch for startup warnings. When connecting third-party models, read the model-recognition warnings in the session startup logs carefully. They usually contain the method for enabling the full window, such as a specific model-name suffix or configuration item.

    3. Build a mock environment for testing. Use a local mock server to take over the API address, spoof different model names, and observe differences in client behavior. This is the most direct way to locate the client’s trimming logic and can also verify the specific values of the reserved buffer.

    4. Perform request auditing at the gateway layer. If you operate a model gateway, you can measure the maximum input length actually sent by clients and compare it with the model’s advertised window. This quickly reveals “client-side trimming” issues, and you can proactively tell users the configuration method in your integration documentation.

    5. Explicitly segment long tasks. Even when the window is fully enabled, you should avoid indiscriminately stuffing all history into the context. For tasks such as codebase analysis and long-cycle refactoring, actively doing session generations and summary deposition is more controllable than relying on auto-compact.

    6. Final Thoughts

    Problems such as “advertised 1M, actual 200k” are essentially a protocol gap between model capability and client capability: the API has no metadata query mechanism, the client can only rely on whitelists and conservative assumptions as a fallback, and silent degradation makes the loss completely invisible. For developers, it is worth building the habit of verifying context utilization. For tool and gateway builders, making window information declarable, probeable, and alertable is the fundamental solution. After all, users pay for the full context window, not a version that has been quietly discounted by the client.