DEDUPED Hot AI repos, turned into use cases Get the Monday 5

How to redact secrets from Anthropic SDK calls locally with Cosy Redact Gateway

Send Anthropic Messages API calls through the local gateway with detection on, using the JavaScript SDK.

Credentials. The Anthropic API key is sent upstream as an authentication header, so keep it out of logs and shared scripts.

Who it is forA JavaScript developer building an app on the Anthropic SDK who needs secrets in prompts stripped before they reach Anthropic.

The problemAnthropic requests carry whatever text the app builds, including tokens pasted from configs or tool output, and those values leave the machine unchanged.

The outcomeYour Anthropic SDK calls go through the gateway with all detectors enabled, and you can confirm the placeholder flow with a synthetic value.

What you need first

  • 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

Steps

  1. Start the gateway from the repo folder with npm start
  2. Install the SDK in your app with npm install @anthropic-ai/sdk (inferred, check the README)
  3. Export your settings with export ANTHROPIC_API_KEY=<your-key> and export ANTHROPIC_MODEL=<model-name> (inferred, check the README)
  4. 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)

Prompt for your agent

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.

Caveat. The README does not guarantee every Anthropic streaming schema, so test the exact event types your app uses with synthetic data first.

Share: X LinkedIn Hacker News Email Copy link

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 [email protected] and we will look at it promptly. Full disclaimer page