用于RAG/LLM基础。返回为LLM优化的预提取网页内容(文本、表格、代码)。支持GET和POST。根据复杂度调整max_tokens/count。
Paid LLM Context proxy via x402 pay-per-use (HTTP 402).
Prerequisites: This skill requires x402-payment. Complete the setup steps before first use.
RoleDomainAPI Providerhttps://www.cpbox.ioFacilitatorhttps://www.cppay.finance
http
GET /api/x402/llm-context
POST /api/x402/llm-context/post
PAYMENT-SIGNATURE) -> 402 Payment Required with requirements JSONPAYMENT-SIGNATUREPAYMENT-SIGNATURE -> Server settles and returns JSONWith @springmint/x402-payment or x402-sdk-go, payment is automatic.
LLM Context delivers pre-extracted, relevance-ranked web content optimized for grounding LLM responses in real-time search results. Unlike traditional web search APIs that return links and snippets, LLM Context extracts the actual page content—text chunks, tables, code blocks, and structured data—so your LLM or AI agent can reason over it directly.
FeatureLLM Context (this)AI Grounding ( answers)OutputRaw extracted content for YOUR LLMEnd-to-end AI answers with citationsInterfaceREST API (GET/POST)OpenAI-compatible /chat/completionsSearchesSingle search per requestMulti-search (iterative research)SpeedFast (<1s)SlowerPlanSearchAnswersEndpoint/res/v1/llm/context``/res/v1/chat/completionsBest forAI agents, RAG pipelines, tool callsChat interfaces, research mode
http
GET https://www.cpbox.io/api/x402/llm-context
POST https://www.cpbox.io/api/x402/llm-context/post
Authentication: handled by x402 payment middleware
Optional Headers:
Accept-Encoding: gzip — Enable gzip compressionbash
curl -s "https://www.cpbox.io/api/x402/llm-context?q=tallest+mountains+in+the+world" \
-H "Accept: application/json"
bash
curl -s --compressed -X POST "https://www.cpbox.io/api/x402/llm-context/post" \
-H "Accept: application/json" \
-H "Accept-Encoding: gzip" \
-H "Content-Type: application/json" \
-d '{"q": "tallest mountains in the world"}'
bash
curl -s "https://www.cpbox.io/api/x402/llm-context" \
-H "Accept: application/json" \
-G \
--data-urlencode "q=rust programming" \
--data-urlencode 'goggles=$discard
$site=docs.rs
$site=rust-lang.org'
bash
npx @springmint/x402-payment \
--url "https://www.cpbox.io/api/x402/llm-context?q=rust+ownership&maximum_number_of_tokens=4096" \
--method GET
ParameterTypeRequiredDefaultDescriptionqstringYes-Search query (1-400 chars, max 50 words)countrystringNoUSSearch country (2-letter country code or ALL)search_langstringNoenLanguage preference (2+ char language code)countintNo20Max search results to consider (1-50)
ParameterTypeRequiredDefaultDescriptionmaximum_number_of_urlsintNo20Max URLs in response (1-50)maximum_number_of_tokensintNo8192Approximate max tokens in context (1024-32768)maximum_number_of_snippetsintNo50Max snippets across all URLs (1-100)maximum_number_of_tokens_per_urlintNo4096Max tokens per individual URL (512-8192)maximum_number_of_snippets_per_urlintNo50Max snippets per individual URL (1-100)
ParameterTypeRequiredDefaultDescriptioncontext_threshold_modestringNobalancedRelevance threshold for including content ( strict/ balanced/ lenient)enable_localboolNonullLocal recall control ( true/ false/ null, see below)gogglesstring/listNonullGoggle URL or inline definition for custom re-ranking
Task Typecountmax_tokensExampleSimple factual52048"What year was Python created?"Standard queries208192"Best practices for React hooks"Complex research5016384"Compare AI frameworks for production"
Larger context windows provide more information but increase latency and cost (of your inference). Start with defaults and adjust.
ModeBehaviorstrictHigher threshold — fewer but more relevant resultsbalancedDefault — good balance between coverage and relevancelenientLower threshold — more results, may include less relevant content
The enable_local parameter controls location-aware recall:
ValueBehaviornull (not set)Auto-detect — local recall enabled when any location header is providedtrueForce local — always use local recall, even without location headersfalseForce standard — always use standard web ranking, even with location headers
For most use cases, omit enable_local and let the API auto-detect from location headers.
HeaderTypeDescriptionX-Loc-LatfloatLatitude (-90.0 to 90.0)X-Loc-LongfloatLongitude (-180.0 to 180.0)X-Loc-CitystringCity nameX-Loc-StatestringState/region code (ISO 3166-2)X-Loc-State-NamestringState/region nameX-Loc-Countrystring2-letter country codeX-Loc-Postal-CodestringPostal code
Priority:
X-Loc-Lat+X-Loc-Longtake precedence. When provided, text-based headers (City, State, Country, Postal-Code) are not used for location resolution. Provide text-based headers only when you don't have coordinates.
bash
curl -s "https://www.cpbox.io/api/x402/llm-context" \
-H "Accept: application/json" \
-H "X-Loc-Lat: 37.7749" \
-H "X-Loc-Long: -122.4194" \
-G \
--data-urlencode "q=best coffee shops near me"
bash
curl -s "https://www.cpbox.io/api/x402/llm-context" \
-H "Accept: application/json" \
-H "X-Loc-City: San Francisco" \
-H "X-Loc-State: CA" \
-H "X-Loc-Country: US" \
-G \
--data-urlencode "q=best coffee shops near me"
Goggles let you control which sources ground your LLM — essential for RAG quality.
Use CaseGoggle RulesOfficial docs only$discard\n$site=docs.python.orgExclude user content$discard,site=reddit.com\n$discard,site=stackoverflow.comAcademic sources$discard\n$site=arxiv.org\n$site=.eduNo paywalls$discard,site=medium.comMethodExampleHosted--data-urlencode "goggles=https://<hosted-goggle-url>"Inline--data-urlencode 'goggles=$discard\n$site=example.com'
Hosted goggles should be hosted on a public URL and include
! name:,! description:,! author:headers. Inline rules need no registration.
Syntax: $boost=N / $downrank=N (1–10), $discard, $site=example.com. Combine with commas: $site=example.com,boost=3. Separate rules with \n ( %0A).
Allow list: $discard\n$site=docs.python.org\n$site=developer.mozilla.org — Block list: $discard,site=pinterest.com\n$discard,site=quora.com
Resources: See your upstream provider's Goggles documentation.
json
{
"grounding": {
"generic": [
{
"url": "https://example.com/page",
"title": "Page Title",
"snippets": [
"Relevant text chunk extracted from the page...",
"Another relevant passage from the same page..."
]
}
],
"map": []
},
"sources": {
"https://example.com/page": {
"title": "Page Title",
"hostname": "example.com",
"age": ["Wednesday, January 15, 2025", "2025-01-15", "392 days ago"]
}
}
}
enable_local)#json
{
"grounding": {
"generic": [...],
"poi": {
"name": "Business Name",
"url": "https://business.com",
"title": "Title of business.com website",
"snippets": ["Business details and information..."]
},
"map": [
{
"name": "Place Name",
"url": "https://place.com",
"title": "Title of place.com website",
"snippets": ["Place information and details..."]
}
]
},
"sources": {
"https://business.com": {
"title": "Business Name",
"hostname": "business.com",
"age": null
}
}
}
FieldTypeDescriptiongroundingobjectContainer for all grounding content by typegrounding.genericarrayArray of URL objects with extracted content (main grounding data)grounding.generic[].urlstringSource URLgrounding.generic[].titlestringPage titlegrounding.generic[].snippetsarrayExtracted smart chunks relevant to the querygrounding.poiobject/nullPoint of interest data (only with local recall)grounding.poi.namestring/nullPoint of interest namegrounding.poi.urlstring/nullPOI source URLgrounding.poi.titlestring/nullPOI page titlegrounding.poi.snippetsarray/nullPOI text snippetsgrounding.maparrayMap/place results (only with local recall)grounding.map[].namestring/nullPlace namegrounding.map[].urlstring/nullPlace source URLgrounding.map[].titlestring/nullPlace page titlegrounding.map[].snippetsarray/nullPlace text snippetssourcesobjectMetadata for all referenced URLs, keyed by URLsources[url].titlestringPage titlesources[url].hostnamestringSource hostnamesources[url].agearray/nullPage modification dates (when available)
Note: Snippets may contain plain text OR JSON-serialized structured data (tables, schemas, code blocks). LLMs handle this mixed format well.
maximum_number_of_tokens=8192, count=20). Reduce for simple lookups, increase for complex research.context_threshold_mode=strict when precision > recall.count and maximum_number_of_tokens that meet your needs. For local queries, provide location headers.