﻿# Brave LLM Context versioning: migrate past legacy snippet-count controls

Migrate a Brave LLM Context client using an explicit API version and current token budget, rather than relying on legacy snippet-count constraints.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-brave-context-version-migration/
Language: en

## Find what the old client assumes

A model gateway may assume the search response contains at most a configured number of snippets. If that assumption lived only in an old wrapper, a pipeline update can enlarge the evidence input without changing the endpoint path. Write down which limits the client actually depends on before treating the upgrade as a routine library change.

## Pin the behavior explicitly

Brave's [versioning guide](https://api-dashboard.search.brave.com/documentation/guides/versioning) separates the major URL version from the dated `Api-Version` header. Requests without that header use the latest version. Record the header value with captured examples; a path containing a major version alone does not identify every response behavior relevant to the integration.

## Read the context-specific migration

The [LLM Context changelog](https://api-dashboard.search.brave.com/documentation/services/llm-context) describes the newer extraction pipeline and says legacy snippet-count controls no longer constrain responses when the token budget permits more snippets. It documents an older pipeline pin through `Api-Version: 2026-02-06`. Treat that as a migration choice to review, rather than assuming an old field still enforces a hard cap.

## Budget the artifact the model receives

The [current reference](https://api-dashboard.search.brave.com/api-reference/ai/llm_context/get) supplies the supported context controls. Use the documented token budget and measure the final assembled input, including source labels and instructions. If the application's own hard limit requires truncation, preserve page ownership and mark omitted evidence; silently cutting text can remove a decisive qualification.

For a reference question, compare the old and new captures on whether the needed exception is retained, how many sources survive, and whether the prompt fits. A larger response is not inherently a regression, while a valid response that overflows the caller's budget is still an integration failure.

## Allow additive evolution

The versioning guide considers new response properties backward compatible. A consumer should tolerate extra metadata while validating fields it actually uses. Avoid snapshot assertions that fail merely because object-property order changes. Keep separate checks for field removal, type changes, and altered context-budget behavior.

The existing guides to [API deprecation migration](/journal/provider-api-contract-deprecation-migration/) and [response contracts](/journal/learn-openrouter-response-contract/) help organize the change. Preserve reviewed fixtures for both versions and document the selected migration state, rather than making an unverified promise that every future default update preserves the old snippet shape.
