# ContextShim (https://contextshim.com) > Intercept, enrich, or answer LLM calls inline. Deterministic wire gateway emulating OpenAI Chat, Anthropic Messages, OpenAI Responses, and Cloud Ollama APIs. ## What ContextShim Does ContextShim sits inline as your `OPENAI_BASE_URL`, `ANTHROPIC_BASE_URL`, or `OLLAMA_HOST` and evaluates deterministic rules (`regex`, `keyword_any`, `model_glob`, `header_match`, `path`, `role_scope`, `project_tag`, `priority`) on every outbound LLM API call: 1. `respond_directly`: Synthesizes a native JSON or `stream: true` SSE/NDJSON response in <10ms at the edge with 0 upstream tokens (guardrail blocks, synthetic liveness probes, deterministic mocks, verified FAQ cache). 2. `inject_context`: Prepends or appends coding standards (`AGENTS.md` / `RULES.md`), SQL safety constraints, or JSON contracts (`system_prepend`, `system_append`, `user_prepend`, `user_append`) before forwarding to Cloud Ollama (`https://ollama.com/v1`) or your BYOK upstream provider (OpenAI, Anthropic, Gemini, OpenRouter). 3. `passthrough_audit`: Forwards cleanly while recording redacted wire metadata, latency, token delta, and SHA-256 request/response digests. ## Native Emulated LLM Wire Endpoints - `POST https://contextshim.com/v1/chat/completions` (OpenAI Chat Completions JSON + `stream: true` SSE) - `GET https://contextshim.com/v1/models` (Supported model catalog) - `POST https://contextshim.com/v1/messages` (Anthropic Messages JSON + `stream: true` SSE) - `POST https://contextshim.com/v1/responses` (OpenAI Responses JSON + `stream: true` SSE) - `POST https://contextshim.com/api/chat` (Cloud Ollama Chat JSON + NDJSON stream) - `POST https://contextshim.com/api/generate` (Cloud Ollama Generate JSON + NDJSON stream) ## 1-Line Agent & SDK Configuration - Claude Code: `ANTHROPIC_BASE_URL=https://contextshim.com` - OpenAI Codex / Python / TypeScript SDK: `OPENAI_BASE_URL=https://contextshim.com/v1` - Cloud Ollama Client: `OLLAMA_HOST=https://contextshim.com` - Optional BYOK Headers: `x-contextshim-key: cshim_live_...`, `x-upstream-provider: ollama|openai|anthropic|gemini|openrouter`, `x-upstream-url: https://...`, `x-upstream-key: ` ## Management REST API - `GET https://contextshim.com/api/v1/rules` - List rules ordered by priority - `POST https://contextshim.com/api/v1/rules` - Create/update rule (CAS-fenced via `expected_version`) - `POST https://contextshim.com/api/v1/simulate` - Dry-run or live wire diff simulator - `GET https://contextshim.com/api/v1/traces` - Recent redacted wire traces with SHA-256 digests - `POST https://contextshim.com/api/v1/keys/mint` - Mint instant `cshim_live_*` developer key - `GET https://contextshim.com/healthz` - Service and upstream readiness status ## Streamable HTTP MCP - Endpoint: `https://contextshim.com/mcp` (`POST /mcp` JSON-RPC 2.0, `GET /mcp` descriptor) - Discovery: `https://contextshim.com/.well-known/mcp.json` and `https://contextshim.com/.well-known/agent-card.json` - Tools: `contextshim_list_rules`, `contextshim_upsert_rule`, `contextshim_simulate`, `contextshim_list_traces`, `contextshim_mint_key` ## Commercial Plans - Free Developer ($0/mo): 10,000 calls/mo, 5 custom rules, all 4 wire protocols, instant `cshim_live_*` key - Pro ($29/mo): 500,000 calls/mo, unlimited rules, zero-token direct cache, dynamic context injection, 30-day traces - Team ($99/mo): 5,000,000 calls/mo, shared org rule packs, CAS versioned approvals, SIEM webhook export - Enterprise (Custom): Dedicated isolates, SAML SSO, custom SLA ## Key Pages - Interactive Wire Simulator: https://contextshim.com/playground - Live Rule Registry: https://contextshim.com/rules - Connect Your Agent: https://contextshim.com/connect - Wire Protocol Docs: https://contextshim.com/docs - Pricing: https://contextshim.com/pricing - Developer Account & Keys: https://contextshim.com/account