{"uid":"cap_MJaqVr0nBJ3rsdH6H_7Gd","slug":"context-preparation-api-inspect-3c64b51d","name":"Context Preparation API — Inspect","description":"Deterministic multi-format cleaning, safety inspection, structural chunking, hybrid ranking, contradiction checks, and target-model token packing for AI agents.","url":"https://nexus-x402-ff2a.onrender.com/v1/inspect","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"redact":{"type":"boolean","description":"Defaults to true for /prepare and false for other operations."},"target":{"type":"object"},"content":{"type":"string"},"question":{"type":"string"},"documents":{"type":"array"},"maxTokens":{"type":"integer"},"chunkTokens":{"type":"integer"},"queryEmbedding":{"type":"array"}}},"responseSchema":{"type":"object","required":["operation","content","chunks","warnings","safety","metrics","target"],"properties":{"chunks":{"type":"array","items":{"type":"object"}},"safety":{"type":"array","items":{"type":"object"}},"target":{"type":"object"},"content":{"type":"string"},"metrics":{"type":"object"},"warnings":{"type":"array","items":{"type":"object"}},"operation":{"enum":["clean","inspect","pack","prepare"]},"potentialContradictions":{"type":"array","items":{"type":"object"}}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.0002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.0002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_g6u--4nEPtPW8llidLAMN","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs deterministic safety inspection, multi-format cleaning, structural chunking, hybrid ranking, contradiction detection, and target-model token packing on text content for AI agent pipelines.","exampleAgentPrompt":"Can you inspect this article for safety issues, detect any contradictions, clean it up, and chunk it into 512-token pieces ranked by relevance to the question 'What are the key risks of autonomous vehicles?' — pack the result for GPT-4 within a 4096-token budget?","exampleUseCases":[{"title":"RAG pipeline document pre-processing","prompt":"I have 10 retrieved documents and a user question about climate policy — can you clean them, rank the chunks by relevance using the query embedding I'll provide, check for contradictions between them, and pack everything into a 3000-token context for my model?"},{"title":"Safety screening before LLM inference","prompt":"Before I send this user-submitted text to my AI assistant, can you run a full safety inspection and flag any harmful content, PII, or policy violations, with redaction enabled?"},{"title":"Structured chunking for long-document QA","prompt":"I have a 20-page legal contract and I need to answer specific questions about it — please chunk it into 256-token pieces, rank them by relevance to 'what are the termination clauses?', and pack the top chunks into a 2048-token window."}],"resultDescription":"Returns a JSON object with: the operation type performed ('clean', 'inspect', 'pack', or 'prepare'), the processed content string, an array of structural chunks (each as an object), a safety array listing any detected issues, a warnings array, a metrics object with processing statistics, a target object describing model context details, and an optional potentialContradictions array listing detected conflicting statements across documents.","failureModes":["Missing required 'content' or 'documents' field returns a validation error","Invalid or out-of-range maxTokens or chunkTokens integers cause processing failure","Malformed queryEmbedding array (wrong dimensions) causes ranking step to fail","Payment not included or insufficient — x402 payment of 0.0002 USDC required per call","Oversized input exceeding model limits may result in truncation warnings or errors","Network timeout on the Render-hosted service during cold start"],"whenToPreferThis":"Choose this endpoint when you need a deterministic, auditable pre-processing pipeline for AI agent context windows — especially when you require safety inspection, contradiction detection, and token-budget-aware packing in a single call. Prefer it over ad-hoc chunking libraries when you need hybrid ranking (semantic + structural) and need the output validated against a specific target model's constraints. It is particularly well-suited for RAG pipelines, long-document QA, and any agentic workflow where untrusted or multi-source documents must be safely ingested before LLM inference.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:40:51.345Z","isFirstParty":false}