Tawa docs

Quickstart

Create a proxy token, point the OpenAI or Anthropic SDK, or curl, at the Tawa Guard hosted proxy, and send your first scanned request.

This page takes you from nothing to a scanned request. You need a Tawa Guard app, a proxy token for it, and a key for the provider you call. If you do not have an app yet, create one on tawaguard.com.

Create a proxy token

In the dashboard, open the app and go to API keys. Under Proxy tokens, create a token, choose its environment and the stages to scan, and copy it. It is shown once, so store it in an environment variable or a secrets manager.

export TAWA_PROXY_TOKEN="tgp_..."

An app can hold up to 3 active proxy tokens per environment. The Connect page of the app has a Proxy tab with the same URLs used below.

Point your client at the proxy

The base URL carries the token and names the provider.

Provider APIBase URL
OpenAI Chat Completions and Responseshttps://proxy.tawaguard.com/<token>/openai/v1
Anthropic Messageshttps://proxy.tawaguard.com/<token>/anthropic

Keep using your own provider key. The client sends it in the usual header and the proxy forwards it. It is not stored.

Send a request

import os

from openai import OpenAI

client = OpenAI(
    base_url=f"https://proxy.tawaguard.com/{os.environ['TAWA_PROXY_TOKEN']}/openai/v1",
    api_key=os.environ["OPENAI_API_KEY"],
)

reply = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(reply.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: `https://proxy.tawaguard.com/${process.env.TAWA_PROXY_TOKEN}/openai/v1`,
  apiKey: process.env.OPENAI_API_KEY,
});

const reply = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(reply.choices[0].message.content);
import os

from anthropic import Anthropic

client = Anthropic(
    base_url=f"https://proxy.tawaguard.com/{os.environ['TAWA_PROXY_TOKEN']}/anthropic",
    api_key=os.environ["ANTHROPIC_API_KEY"],
)

reply = client.messages.create(
    model="claude-haiku-4-5",
    max_tokens=256,
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(reply.content[0].text)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: `https://proxy.tawaguard.com/${process.env.TAWA_PROXY_TOKEN}/anthropic`,
  apiKey: process.env.ANTHROPIC_API_KEY,
});

const reply = await client.messages.create({
  model: "claude-haiku-4-5",
  max_tokens: 256,
  messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(reply.content[0]);
curl "https://proxy.tawaguard.com/$TAWA_PROXY_TOKEN/openai/v1/chat/completions" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Say hello in five words."}]}'

A normal reply comes back from the provider. A blocked request returns a 400 in the provider's own error format. See Error codes.

Check it in Monitoring, then block

A new app is in Monitoring: requests are scanned and forwarded, never blocked. Run your normal traffic and review what would have been blocked. When you are ready, switch the app to Blocking in App settings, Scanning and blocking. See Scanning and blocking.

Next steps

On this page