STACK
MENU
DOCS / GETTING STARTED / MAKE A GOVERNED MODEL CALL

Make a governed model call

This quickstart makes one real Anthropic, OpenAI or OpenRouter request through STACK. The provider credential stays in STACK's vault while the gateway checks the agent's access, issues a short-lived Passport and records the result.

Before you start

Create your STACK account, then connect an LLM provider in Connect. You do not need to connect an AI client for this flow.

1. Sign the CLI in

Run this in a terminal:

bash
npx @getstackrun/cli auth login

The command opens a browser for approval, then stores the CLI refresh token in your local STACK profile. It does not ask for the LLM provider credential.

2. Run the governed call

In the same terminal, run:

bash
npx @getstackrun/cli quickstart --provider anthropic

Use openai or openrouter instead when that is the provider you connected. The command creates a proxy-only, logged, STACK-managed agent or reuses an existing agent with that exact posture, grants it access to the selected provider, issues a Passport and makes one small model request. It then prints the latest audit entry for that agent so you can see that the request passed through STACK.

The provider can charge for the request. On self-serve plans, STACK charges a gateway fee equal to 15% of the calculated provider cost; Enterprise pricing is negotiated separately. The request also counts as one recorded action.

Use STACK with an existing tool

After the quickstart works, proxy serve can place a local STACK gateway in front of a tool that accepts a custom model-provider URL:

bash
npx @getstackrun/cli proxy serve   --agent quickstart-bot   --provider anthropic

Point the tool at:

text
http://127.0.0.1:8788

The shim accepts Anthropic Messages requests at /v1/messages and OpenAI-compatible Chat Completions requests at /v1/chat/completions. STACK verifies the Passport, applies the agent's access rules, injects the provider credential and records the result.

A STACK-managed agent uses the CLI's operator sign-in to issue Passports. The provider key remains in STACK, but the machine still holds the STACK refresh token. Use a customer-managed agent when the runtime should hold only its own agent key.

The endpoint listens only on the local machine by default. Do not expose it to a network without authentication and a firewall.

Request controls

STACK can redact supported PII patterns and add the agent's current Passport context before sending a request.

Pattern-based redaction can miss sensitive data or redact harmless text. Do not send data that the model does not need. If redaction is disabled, supported user content reaches the provider without STACK redaction.

Production integrations

Use the JavaScript or Python SDK when your application calls the gateway directly.

JavaScript and TypeScript

Python

LLM Gateway API

The API reference covers supported endpoints, streaming, Passport requirements, request limits, billing, errors, and usage records.

stack | Docs