Skip to main content

Proxy API

The Steward Proxy runs on a separate port (default: 8080) and handles credential injection for outbound API requests. Agents make requests to the proxy, and Steward injects real credentials before forwarding.

Base URL

http://steward-proxy:8080
Typically accessed from within the Docker network. Not exposed to the public internet.

Authentication

All proxy requests require an agent JWT:
Authorization: Bearer stwd_agent_jwt_...

Making Requests

Via Named Alias

Named aliases provide a clean URL pattern:
# OpenAI
curl -X POST http://steward-proxy:8080/openai/v1/chat/completions \
  -H "Authorization: Bearer agent-jwt" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

# Anthropic
curl -X POST http://steward-proxy:8080/anthropic/v1/messages \
  -H "Authorization: Bearer agent-jwt" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
The proxy:
  1. Strips the agent’s Authorization header
  2. Resolves openaiapi.openai.com
  3. Finds the matching route for api.openai.com/*
  4. Decrypts and injects the real credential
  5. Forwards to https://api.openai.com/v1/chat/completions

Via Direct Host

For APIs without a named alias:
curl -X GET http://steward-proxy:8080/proxy/public-api.birdeye.so/defi/price?address=So11... \
  -H "Authorization: Bearer agent-jwt"

SDK Integration

Most LLM SDKs support custom base URLs, making proxy integration trivial:
import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: "steward",  // dummy — stripped by proxy
  baseURL: `${process.env.STEWARD_PROXY_URL}/openai/v1`,
});

const response = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Hello" }],
});

Proxy Endpoints

ANY /:alias/*         → Proxied via named alias (e.g., /openai/v1/...)
ANY /proxy/:host/*    → Proxied via direct host (e.g., /proxy/api.example.com/...)

Error Responses

StatusMeaning
401Invalid or missing agent JWT
403No route configured for this host/path, or policy denied
502Upstream API error
504Upstream API timeout
{
  "ok": false,
  "error": "No credential route configured for this endpoint"
}

Configuring Aliases

Aliases are configured per-tenant via route definitions. When you create a route for api.openai.com, the alias openai is automatically available. Default alias mappings:
AliasHost
openaiapi.openai.com
anthropicapi.anthropic.com
birdeyepublic-api.birdeye.so
Custom aliases can be configured by the platform operator.