Skip to content
DocsContext sources
Core features

Context sources

A context source is a document your organization uploads once, such as a runbook, a policy or a product manual. When a request names it, the gateway picks the sections that answer the request and adds only those, so the model answers from your documents without your application searching them. Which keys may use which documents, and every use, is recorded.

Why it matters
  • Governed. No key can use a document until a workspace admin gives it access, and the audit log records every change and every agent read.
  • Only what is needed. A request gets the relevant sections within a token budget, not the whole document.
  • No code change. One header, or a default on the virtual key, works with the OpenAI SDK, the Claude SDK and the Responses API, and agents can read the same documents over MCP.
  • Kept private. Section text is encrypted per organization and never written to request logs; a log row names the sections, not their text.
Context sources are part of the Pro and Enterprise plans.
1. Upload a document

On Context sources, upload a Markdown, HTML or PDF file of up to 15 MB, give it a name, and pick the virtual key that pays for indexing. The gateway:

  1. splits the document into sections along its headings (pages are kept for PDFs). A document that numbers its clauses without headings, as most contracts do, is split at each numbered clause instead (“4.2 Payment.”, “ARTICLE IV”, “Schedule B”);
  2. scans it for prompt injection and secrets. A finding holds the source as QUARANTINED until a workspace admin reviews the findings and releases it;
  3. writes a one-sentence summary of each section with a model on that virtual key (default gpt-6-luna), billed to the key like any request. The source is then READY.

The Outline tab shows the sections with their summaries. Selection reads these summaries, so a workspace admin can rewrite one that misses the point; reindexing keeps the edit. A failed indexing run can be retried with another key or model. Uploading through the API is in the API reference (Context sources).

2. Give keys access

On the source’s Key access tab, tick the virtual keys that may use it. A new source has no keys; a request on any other key naming the source is refused. The same tab sets which keys use the source by default and which MCP keys may read it.

3. Use it on a request

Name the source in the x-context-source header (up to 5, comma-separated). It works on /v1/chat/completions, the Claude SDK’s /v1/messages and the /v1/responses API, streamed or not:

Bash
curl https://api.vectoraxis.ai/v1/chat/completions \
  -H "Authorization: Bearer $VECTORAXIS_VIRTUAL_KEY" \
  -H "x-context-source: ctx-1a2b3c4d5e6f7a8b" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6-luna",
       "messages": [{"role": "user", "content": "How do I roll back a release?"}]}'

The gateway reads the outline of each source, asks a selection model on your key which sections answer the last user message, and adds their text to the request before guardrails run. The answer’s x-context-status says what happened and x-context-sections lists the sections added:

StatusMeaning
APPLIEDSections were added.
LOW_CONFIDENCESections were added, but the selection was unsure they answer the request.
NO_MATCHNo section is relevant; the request was sent without context.
NO_QUESTIONThe request has no user text to choose for.
SELECT_FAILEDSelection failed; the request was sent without context.
SELECT_TIMEOUTSelection took longer than its time limit; the request was sent without context.
UNAVAILABLEThe key’s default sources can no longer be used (deleted, access removed, or not ready).

When every section of the sources fits the token budget, the gateway adds them all and makes no selection call, so small documents add no selection time. Further headers set the token budget (default 6,000), the selection model, a time limit on selection (default 8 seconds), and whether a request should fail rather than go out without context; they are described with every header in Request headers.

With a routing config. To use context sources with x-config, send your virtual key as well. The key must have access to the sources, and it pays for choosing the sections; its default sources apply too. The sections are chosen once, so whichever target the config picks, including a fallback, answers from the same sections:

Bash
curl https://api.vectoraxis.ai/v1/chat/completions \
  -H "Authorization: Bearer $VECTORAXIS_VIRTUAL_KEY" \
  -H "x-config: cfg-support-fallback" \
  -H "x-organization: acme" \
  -H "x-context-source: ctx-1a2b3c4d5e6f7a8b" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6-luna",
       "messages": [{"role": "user", "content": "How do I roll back a release?"}]}'
Selection costs one model call. It runs on the request’s virtual key and is logged as its own row (context_select). The same question on the same sources reuses the last selection for a day at no cost, and the outline it reads is marked for the provider’s prompt cache, so later questions on the same documents are quicker and cheaper.
Long documents and cross-references

Long documents often point to themselves. A clause near the end of a contract says “up to the Cap in Section 1.1”, or a policy says “at the rates in Schedule B”. The answer then depends on two places in the document: the section that answers the question, and the section it points to. The gateway follows those pointers for you.

1
The relevant sections are chosen as usual
For a question such as “How much can we recover if the supplier breaks the indemnity?”, the gateway picks clause 9.2, Indemnity, which says: “Each party shall indemnify the other, up to the Cap in Section 1.1.”
2
The sections they point to are added
The gateway reads the chosen sections for references written with a number or letter (“Section 1.1”, “Clause 7”, “Article IV”, “Schedule B”) and adds the sections they name. Here that is clause 1.1, Cap: “The Cap is two million dollars.”
3
The model answers from both
Without clause 1.1 the model can only say “up to the Cap”. With it, the answer is “up to two million dollars”.

Good to know:

  • It costs nothing extra. Finding and adding the referenced sections needs no model call; you pay only for the added text, like any other context.
  • Your chosen sections come first. Referenced sections use at most 30% of the token budget, so they never push out a section that was chosen for the question.
  • One step only. A referenced section’s own references are not followed.
  • Numbered references only. Words such as “the foregoing” or “as defined above” do not name a section, so they are not followed.
  • See it happen. Try a question marks each added section “Added because n14 refers to it”, and in Request logs those sections are shown in blue, marked “ref”.
Documents uploaded before November 20, 2026 keep the sections they were split into then. If a contract was split by page rather than by clause, upload it again so its references can be followed.
Default sources on a key

Under Use by default on Key access, a key with access can use the source on every request, with no header and no code change. A key can have up to 5 default sources. A request’s own x-context-source replaces the defaults, and x-context-source: none turns them off. A default that can no longer be used is skipped instead of failing the request.

Agents over MCP

Agents connected to the gateway’s own MCP server, https://mcp.vectoraxis.ai/s/vectoraxis with an MCP key, can browse and read the sources that key was given (Key access, MCP keys):

ToolWhat it returns
context_sourcesThe sources the key may read, with a summary of each.
context_outlineA source’s sections: id, title, pages, size and summary.
context_readThe text of up to 8 sections, at most 30,000 tokens per call, and the sections each one refers to, so the agent can read those too. Recorded in the source’s audit log.

The agent’s own model decides which sections to read, so these tools make no model call and cost nothing beyond the agent’s own tokens. Setting up an agent is in Connecting agents.

Caching
  • Provider prompt caching. The added sections are marked for the provider’s prompt cache on Anthropic (and Claude on Vertex AI) and on OpenAI models from GPT-5.6, so the same sections are billed at the cache-read rate while the provider keeps them. See Provider prompt caching.
  • Response cache. With x-cache-mode: simple, a request that gets the same sections and the same question is a hit. With semantic, similar questions on the same sources share an answer; answers never cross to other documents.
Check what a question gets
  • Try a question shows which sections a question would get on a chosen key, drawn step by step, and can ask the model with them.
  • Test set holds questions with the sections that should answer them. A run reports how many were found (recall) and how long selection took (median and 95th percentile), so you can see the effect of an edited summary or another selection model. Skip the cache times every question as a new one.
  • In Request logs, a request with context shows what was considered, chosen and added, and links to its selection call.
Retention and deletion

A source can be deleted after a number of days (Retention) or by hand. Deleting removes its sections, its key access and its place in every key’s defaults; the audit log is kept. The uploaded file itself is never stored, only the parsed section text.

NVIDIA Inception Program member

VectorAxis is built by GK Labs, a member of NVIDIA Inception.