Gateway

A gateway is the governed front door between your team's AI tools and the model provider. Tools speak their native protocol to the gateway; the gateway applies governance and forwards the request upstream with the caller's own credentials.

The request path

sequenceDiagram
    participant CC as Claude Code / SDK
    participant GW as Unyform Gateway
    participant DB as Org store (blueprints + vectors)
    participant AN as Anthropic API
    CC->>GW: POST /gw/{id}/v1/messages (your API key)
    GW->>DB: load blueprint + retrieve relevant code
    GW->>GW: inject context, run input policies
    GW->>AN: forward with YOUR key (BYOK)
    AN-->>GW: response / SSE stream
    GW-->>CC: passthrough + audit entry

Bring your own key (BYOK)

The gateway never holds your provider credentials. Whatever key your tool sends โ€” x-api-key or Authorization: Bearer โ€” is forwarded verbatim to the provider. Governance happens around your request, not by impersonating you.

Endpoints

POST/gw/{gateway-id}/v1/messages

Native Anthropic protocol โ€” what Claude Code and the Anthropic SDK use. Streaming (SSE) passes through unchanged.

POST/gw/{gateway-id}/v1/messages/count_tokens

Claude Code's preflight token count. Context injection runs here too, so the count reflects what the real request will send.

POST/gw/{gateway-id}/v1/chat/completions

OpenAI-compatible protocol for tools that speak it.

Calling it directly

curl https://gateway.unyform.ai/gw/<gateway-id>/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-sonnet-4-6", "max_tokens": 1024,
       "messages": [{"role": "user", "content": "Refactor the circuit breaker."}]}'
import anthropic

client = anthropic.Anthropic(
    base_url="https://gateway.unyform.ai/gw/<gateway-id>",
)
msg = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Refactor the circuit breaker."}],
)

What governance adds to each request

  1. Blueprint injection โ€” your repo's architecture and conventions, prepended as cached system context.
  2. Retrieved code context โ€” semantic search over your org's code embeddings finds the most relevant existing functions, so generated code matches what's already there.
  3. Policies โ€” input/output checks against your org's rules.
  4. Audit โ€” every request logged with what was injected and what happened.

Note

Response headers x-unyform-blueprints and x-unyform-blueprint-tokens show governance at work on every response.

Gateway lifecycle

Create gateways per team or per environment in Dashboard โ†’ Gateways. Each gateway pins: attached blueprints, enabled providers (with per-provider passthrough), and policy configuration. Deactivating a gateway immediately 503s its traffic.

Edit this page on GitHub