{
 "schema_version": 1,
 "generated": "2026-10-23",
 "id": "cassiopeiacode-cosyredactgateway--route-anthropic-sdk-calls-through-local-gateway",
 "repo": "CassiopeiaCode/CosyRedactGateway",
 "repo_url": "https://github.com/CassiopeiaCode/CosyRedactGateway",
 "repo_slug": "cassiopeiacode-cosyredactgateway",
 "title": "Redact secrets from Anthropic SDK calls locally",
 "page_title": "How to redact secrets from Anthropic SDK calls locally with Cosy Redact Gateway",
 "summary": "Send Anthropic Messages API calls through the local gateway with detection on, using the JavaScript SDK.",
 "who": "A JavaScript developer building an app on the Anthropic SDK who needs secrets in prompts stripped before they reach Anthropic.",
 "problem": "Anthropic requests carry whatever text the app builds, including tokens pasted from configs or tool output, and those values leave the machine unchanged.",
 "outcome": "Your Anthropic SDK calls go through the gateway with all detectors enabled, and you can confirm the placeholder flow with a synthetic value.",
 "steps": [
  "Start the gateway from the repo folder with `npm start`",
  "Install the SDK in your app with `npm install @anthropic-ai/sdk` (inferred, check the README)",
  "Export your settings with `export ANTHROPIC_API_KEY=<your-key>` and `export ANTHROPIC_MODEL=<model-name>` (inferred, check the README)",
  "Set the client baseURL to `http://127.0.0.1:8787/$https://api.anthropic.com` and save the example as a `.mjs` file, then run it with `node <file>.mjs` (inferred, check the README)"
 ],
 "agent_prompt": "Start the CosyRedactGateway with `npm start` and create a Node script in <your-app-path> that uses `@anthropic-ai/sdk` with baseURL `http://127.0.0.1:8787/$https://api.anthropic.com`. Run it with a synthetic value and confirm the output, noting that the SDK appends `/v1/messages` and that no extra `/v1` should be added to the base URL.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "The README does not guarantee every Anthropic streaming schema, so test the exact event types your app uses with synthetic data first.",
 "category": "Security and science",
 "tags": [
  "Security and science"
 ],
 "lang": "javascript",
 "requirements": [
  "Node.js 20+, Git, and a terminal",
  "An OpenAI or Anthropic API key and an available model name, only if you make live upstream calls",
  "A trusted environment for running the gateway, since it handles raw requests and provider credentials"
 ],
 "risk": "sensitive",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "credentials",
   "notice": "The Anthropic API key is sent upstream as an authentication header, so keep it out of logs and shared scripts."
  }
 ],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/cassiopeiacode-cosyredactgateway/route-anthropic-sdk-calls-through-local-gateway/",
 "md": "https://dedupedai.com/use-cases/cassiopeiacode-cosyredactgateway/route-anthropic-sdk-calls-through-local-gateway/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/cassiopeiacode-cosyredactgateway--route-anthropic-sdk-calls-through-local-gateway.json",
 "api_version": "v1"
}
