const client = new OpenAI({ apiKey: "sk-proj-abc123…"});await client.chat.completions.create({…}); const client = new OpenAI({ baseURL: "https://gw.acme.io/api/<uuid>/v1", apiKey: process.env.PG_TOKEN // pg_live_…}); Six scenarios — three problems PromptGate quietly solves (keys, costs, PII), three capabilities it unlocks (one-click MCP, multi-provider routing, central observability). Each shown as a Before / After diff.
The OpenAI key sits right next to the React component. It lands in Git, in the bundle, on a contractor's laptop — every commit a permanent exposure.
const client = new OpenAI({ apiKey: "sk-proj-abc123…"});await client.chat.completions.create({…}); const client = new OpenAI({ baseURL: "https://gw.acme.io/api/<uuid>/v1", apiKey: process.env.PG_TOKEN // pg_live_…}); A senior dev leaves. Their personal OpenAI key powered the team chatbot, the eval pipeline and a forgotten cron. Nobody knows which is which — revoke breaks production.
$ openai keys revoke sk-proj-abc…# 14 services start returning 401chatbot.prod ❌ eval-pipeline ❌whose-cron-is-this ❌ status-bot ❌ $ pg tokens revoke ada@acme.io# Only Ada's tokens are revoked.Other team tokens keep working —every service is auditable, per-owner. A test harness hits GPT-4 in a while(true) because someone forgot a break. Eleven hours later, $11,200 burned. The invoice arrives two months in.
while (true) { await openai.chat({ model: "gpt-4o" });} // 11h × $1 020/h = $11 200🔥 OpenAI: invoice paid in advance while (true) { await openai.chat({ model: "gpt-4o" });} // PG: monthly_budget_usd: 500✓ Calls return 422 after $500. Sleep. You want Claude Code to talk to your internal billing API. The traditional answer is a custom MCP server. The PromptGate answer is: paste the OpenAPI URL, attach a credential, point the agent at the resulting MCP URL.
# Write 200 LOC: tool defs, auth, schemasclass BillingMcpServer: tools = [ /* hand-mapped per endpoint */ ] # then host it, monitor it, scale it… # Paste OpenAPI URL in the PG UI$ claude --mcp-add billing \ https://gw.acme.io/mcp/<uuid>/billing✓ 18 tools auto-discovered. Auth: PG token. You want to send long inputs to Claude (cheaper per million tokens) and short ones to GPT-4o-mini (lower latency). The traditional answer is a router service. The PromptGate answer is a YAML rule on the endpoint.
const provider = msg.length > 8000 ? anthropicClient // refactor SDKs, : openaiClient; // keys, retries…await provider.call({ … }); # Routing rules · per endpoint:- when: input_tokens > 8000 use: anthropic:claude-sonnetdefault: openai:gpt-4o-mini The personalised-reply feature wants the customer's email and name in the prompt. Sending them raw is a GDPR landmine. PromptGate substitutes opaque tokens on the way out and the real values back on the way in.
prompt = f"""Reply to {user.email} about case {case_id}.Customer name: {user.full_name}.""" // sent raw to OpenAI prompt = f"""Reply to [[EMAIL_001]] about case [[ID_002]].Customer name: [[NAME_003]].""" // PG re-substitutes on the way back Pull the image, point your SDK at your gateway, and stop choosing between security, capability and budget.