stockyard

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: MIT

README

═══ STOCKYARD ═══

Self-hosted LLM proxy and control plane in one Go binary

Website · Docs · Playground · Changelog

Go License Modules Providers


Stockyard sits between your app and your LLM providers. Point your OPENAI_BASE_URL at it and you get cost tracking, caching, safety filters, rate limiting, audit trails, and observability — without adding any dependencies to your stack.

Single Go binary. Embedded SQLite. No Redis, no Postgres, no Docker required.

See It Work in 60 Seconds

# Install (~15MB binary)
curl -fsSL https://stockyard.dev/install.sh | sh

# Start (all services on one port)
stockyard serve
# → Stockyard running on :4200
# → Proxy:   http://localhost:4200/v1
# → Console: http://localhost:4200/ui

# Send a request through the proxy
curl http://localhost:4200/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

That request just flowed through 58 middleware modules — rate limiter, cost tracker, safety filter, cache check, audit logger — and back. No configuration. Check the results:

# See the trace (cost, latency, tokens, provider)
curl http://localhost:4200/api/observe/traces?limit=1

# See the audit event (hash-chained, tamper-evident)
curl http://localhost:4200/api/trust/ledger?limit=1

# See cost attribution
curl http://localhost:4200/api/observe/costs

Or open http://localhost:4200/ui in your browser for the full dashboard.

What You Get

Component What it does
Proxy OpenAI-compatible gateway with 58 middleware modules and 16 provider integrations
Observe Automatic request tracing, per-model cost dashboards, anomaly detection, alerts
Trust SHA-256 hash-chained audit ledger, policy enforcement, compliance evidence export
Studio Versioned prompt templates, A/B experiments, model benchmarks
Forge DAG workflow engine for chaining LLM calls, transforms, and tool calls
Exchange Config pack marketplace — install pre-built provider/module/workflow bundles

All six run from the same binary on the same port. No microservices.

When Stockyard Is NOT the Right Fit

  • You only need a thin API shim. If you just want to swap between OpenAI and Anthropic with no middleware, LiteLLM is simpler.
  • You need 100+ provider integrations. Stockyard supports 16 providers today. LiteLLM supports 100+.
  • You want managed-only. Stockyard is self-hosted first. Managed cloud is available but the core experience is running the binary yourself.
  • You need a prompt-only tool. If you only want prompt versioning and don't need a proxy, dedicated tools like PromptLayer or Humanloop are more focused.
  • You're not using LLMs in production yet. Stockyard solves production problems — cost overruns, audit requirements, safety filtering, provider failover. If you're still prototyping, you don't need this yet.

Architecture

Your App (OpenAI SDK)
        │
        ▼
┌─── STOCKYARD (:4200) ───────────────────────┐
│                                               │
│  Request → [58 middleware modules] → Provider │
│            rate limit → cache → safety →      │
│            cost cap → route → failover        │
│                                               │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐     │
│  │ Observe  │ │  Trust   │ │  Studio  │     │
│  │ traces   │ │ audit    │ │ prompts  │     │
│  │ costs    │ │ policies │ │ A/B test │     │
│  └──────────┘ └──────────┘ └──────────┘     │
│  ┌──────────┐ ┌──────────┐                  │
│  │  Forge   │ │ Exchange │  SQLite (WAL)    │
│  │ workflows│ │ packs    │  ~15MB binary    │
│  └──────────┘ └──────────┘                  │
└───────────────────────────────────────────────┘
  • Single binary, single port, single process. No orchestration.
  • Embedded SQLite with WAL mode. No external database.
  • 58 middleware modules, each toggleable at runtime via PUT /api/proxy/modules/{name}.
  • 16 LLM providers: OpenAI, Anthropic, Gemini, Groq, Mistral, DeepSeek, Ollama, VLLM, AWS Bedrock, Azure OpenAI, Cohere, Together AI, Fireworks, Replicate, Perplexity, Hugging Face.
  • AES-256-GCM encryption for all provider keys at rest.
  • 400ns per-request overhead across the full 58-module chain (benchmarks).

Use It With Any OpenAI SDK

from openai import OpenAI

# Just change the base URL. Everything else stays the same.
client = OpenAI(
    base_url="http://localhost:4200/v1",
    api_key="your-openai-key"
)

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}]
)

Works with any OpenAI-compatible client — Python, Node, Go, curl. Switch providers by changing the model name.

Toggle Modules at Runtime

# Check what's running
curl localhost:4200/api/proxy/modules | jq '.count'
# → 58

# Disable caching
curl -X PUT localhost:4200/api/proxy/modules/cache -d '{"enabled": false}'

# Enable rate limiting at 100 RPM
curl -X PUT localhost:4200/api/proxy/modules/ratelimit -d '{"enabled": true, "rpm": 100}'

vs LiteLLM

LiteLLM is a Python LLM router. Stockyard is a router plus local observability and audit in one deploy.

Stockyard LiteLLM
Language Go Python
Dependencies Zero (single binary) Redis + Postgres + Docker
Database Embedded SQLite External Postgres
Observability Built-in (Observe) External (Langfuse, etc.)
Audit trail Hash-chained ledger Not included
Prompt management Built-in (Studio) Not included
Workflow engine Built-in (Forge) Not included
Providers 16 100+
Self-hosted curl install, 30s Docker Compose
Binary size ~15MB ~200MB Docker image

Security

  • Provider keys encrypted at rest — AES-256-GCM with random nonce per write
  • Hash-chained audit ledger — every event cryptographically linked to the previous
  • API keys hashed — SHA-256, never stored in plaintext
  • No key leakage — provider keys never appear in logs, traces, or API responses

Build from Source

git clone https://github.com/stockyard-dev/stockyard.git
cd stockyard
CGO_ENABLED=0 go build -o stockyard ./cmd/stockyard/
./stockyard serve

Requires Go 1.22+. No other dependencies.

Pricing

Self-hosted free tier includes 20 modules, 3 providers, and 1,000 requests/month. Individual ($9.99/mo) unlocks all 58 modules, all 16 providers, and 10,000 requests/month. Pro and above are unlimited.

See stockyard.dev/pricing for details.

Documentation

License

Stockyard is licensed under the MIT License. Free to use, modify, and distribute.


stockyard.dev — Where LLM traffic gets sorted.

Directories

Path Synopsis
cmd
abrouter command
ABRouter — Stockyard Phase 3 P2 product.
ABRouter — Stockyard Phase 3 P2 product.
agegate command
AgeGate — Stockyard Phase 3 P2 product.
AgeGate — Stockyard Phase 3 P2 product.
agentguard command
AgentGuard — Stockyard Phase 3 P2 product.
AgentGuard — Stockyard Phase 3 P2 product.
agentreplay command
alertpulse command
AlertPulse — "PagerDuty for your LLM stack."
AlertPulse — "PagerDuty for your LLM stack."
anomalyradar command
anthrofit command
AnthroFit — Use Claude with OpenAI SDKs.
AnthroFit — Use Claude with OpenAI SDKs.
approvalgate command
ApprovalGate — Stockyard Phase 3 P2 product.
ApprovalGate — Stockyard Phase 3 P2 product.
audioproxy command
authgate command
batchqueue command
BatchQueue — "Fire-and-forget LLM requests with automatic retries."
BatchQueue — "Fire-and-forget LLM requests with automatic retries."
billsync command
BillSync — Stockyard Phase 3 P3 product.
BillSync — Stockyard Phase 3 P3 product.
canarydeploy command
chainforge command
ChainForge — Stockyard Phase 3 P3 product.
ChainForge — Stockyard Phase 3 P3 product.
chaosllm command
chatmem command
ChatMem — "Persistent conversation memory without eating context window."
ChatMem — "Persistent conversation memory without eating context window."
clidash command
clustermode command
ClusterMode — Stockyard Phase 3 P3 product.
ClusterMode — Stockyard Phase 3 P3 product.
codefence command
CodeFence — Stockyard Phase 3 P2 product.
CodeFence — Stockyard Phase 3 P2 product.
codelang command
cohorttrack command
compliancelog command
ComplianceLog — "Immutable audit trail for every LLM interaction."
ComplianceLog — "Immutable audit trail for every LLM interaction."
consentgate command
contextpack command
ContextPack — "RAG without the vector database."
ContextPack — "RAG without the vector database."
contextwindow command
ContextWindow — Stockyard Phase 3 P2 product.
ContextWindow — Stockyard Phase 3 P2 product.
convofork command
costcap command
CostCap — "Never get a surprise LLM bill again."
CostCap — "Never get a surprise LLM bill again."
costmap command
costpredict command
cronllm command
CronLLM — Stockyard Phase 3 P3 product.
CronLLM — Stockyard Phase 3 P3 product.
datamap command
devproxy command
DevProxy — Stockyard Phase 3 P2 product.
DevProxy — Stockyard Phase 3 P2 product.
diffprompt command
DiffPrompt — Stockyard Phase 3 P3 product.
DiffPrompt — Stockyard Phase 3 P3 product.
docparse command
driftwatch command
DriftWatch — Stockyard Phase 3 P2 product.
DriftWatch — Stockyard Phase 3 P2 product.
edgecache command
embedcache command
EmbedCache — Never compute the same embedding twice.
EmbedCache — Never compute the same embedding twice.
embedrouter command
encryptvault command
EncryptVault — Stockyard Phase 3 P3 product.
EncryptVault — Stockyard Phase 3 P3 product.
envsync command
errornorm command
evalgate command
EvalGate — "Never ship a broken LLM response to your users."
EvalGate — "Never ship a broken LLM response to your users."
extractml command
feedbackloop command
FeedbackLoop — Stockyard Phase 3 P2 product.
FeedbackLoop — Stockyard Phase 3 P2 product.
finetunetrack command
framegrab command
geminishim command
GeminiShim — Stockyard Phase 3 P2 product.
GeminiShim — Stockyard Phase 3 P2 product.
geoprice command
guardrail command
GuardRail — Stockyard Phase 3 P2 product.
GuardRail — Stockyard Phase 3 P2 product.
hallucicheck command
HalluciCheck — Stockyard Phase 3 P2 product.
HalluciCheck — Stockyard Phase 3 P2 product.
idlekill command
IdleKill — "Kill runaway LLM requests burning money doing nothing."
IdleKill — "Kill runaway LLM requests burning money doing nothing."
imageproxy command
ImageProxy — Stockyard Phase 3 P2 product.
ImageProxy — Stockyard Phase 3 P2 product.
ipfence command
IPFence — "IP allowlisting and geofencing for your LLM endpoints."
IPFence — "IP allowlisting and geofencing for your LLM endpoints."
jsonguard command
JSONGuard — "Guarantee valid JSON from any LLM."
JSONGuard — "Guarantee valid JSON from any LLM."
keypool command
KeyPool — "Stop hitting rate limits with a single API key."
KeyPool — "Stop hitting rate limits with a single API key."
langbridge command
LangBridge — Stockyard Phase 3 P2 product.
LangBridge — Stockyard Phase 3 P2 product.
llmbench command
LLMBench — Stockyard Phase 3 P3 product.
LLMBench — Stockyard Phase 3 P3 product.
llmcache command
CacheLayer — "Cut your LLM costs by 30%+ with one line."
CacheLayer — "Cut your LLM costs by 30%+ with one line."
llmsync command
LLMSync — Stockyard Phase 3 P3 product.
LLMSync — Stockyard Phase 3 P3 product.
llmtap command
LLMTap — "Stripe Dashboard for your LLM spend."
LLMTap — "Stripe Dashboard for your LLM spend."
loadforge command
localsync command
LocalSync — Stockyard Phase 3 P2 product.
LocalSync — Stockyard Phase 3 P2 product.
maskmode command
MaskMode — Stockyard Phase 3 P3 product.
MaskMode — Stockyard Phase 3 P3 product.
mirrortest command
MirrorTest — Stockyard Phase 3 P3 product.
MirrorTest — Stockyard Phase 3 P3 product.
mockllm command
MockLLM — "Deterministic LLM responses for testing and CI/CD."
MockLLM — "Deterministic LLM responses for testing and CI/CD."
modelalias command
modelswitch command
ModelSwitch — "Route every request to the right model automatically."
ModelSwitch — "Route every request to the right model automatically."
multicall command
MultiCall — "Get the best answer by asking multiple models."
MultiCall — "Get the best answer by asking multiple models."
outputcap command
OutputCap — Stockyard Phase 3 P2 product.
OutputCap — Stockyard Phase 3 P2 product.
paramnorm command
partialcache command
personaswitch command
playbackstudio command
policyengine command
promptchain command
promptfuzz command
promptguard command
PromptGuard — "Stop PII leaks and prompt injection before they happen."
PromptGuard — "Stop PII leaks and prompt injection before they happen."
promptlint command
PromptLint — Stockyard Phase 3 P2 product.
PromptLint — Stockyard Phase 3 P2 product.
promptmarket command
promptpad command
PromptPad — "Version, A/B test, and deploy prompts without code changes."
PromptPad — "Version, A/B test, and deploy prompts without code changes."
promptrank command
promptreplay command
PromptReplay — "Record and replay every LLM call."
PromptReplay — "Record and replay every LLM call."
promptslim command
PromptSlim — Stockyard Phase 3 P2 product.
PromptSlim — Stockyard Phase 3 P2 product.
proxylog command
queuepriority command
quotasync command
rateshield command
RateShield — "Protect your LLM endpoints from abuse."
RateShield — "Protect your LLM endpoints from abuse."
regionroute command
RegionRoute — Stockyard Phase 3 P2 product.
RegionRoute — Stockyard Phase 3 P2 product.
retentionwipe command
retrypilot command
RetryPilot — "Production-grade retries with circuit breaking and model downgrade."
RetryPilot — "Production-grade retries with circuit breaking and model downgrade."
routefall command
RouteFall — "Automatic LLM failover that just works."
RouteFall — "Automatic LLM failover that just works."
scopeguard command
secretscan command
SecretScan — "Catch API keys and secrets leaking in requests and responses."
SecretScan — "Catch API keys and secrets leaking in requests and responses."
semanticcache command
sessionstore command
slotfill command
snapshottest command
spotprice command
stockyard command
Stockyard — "Where LLM traffic gets sorted."
Stockyard — "Where LLM traffic gets sorted."
streamcache command
streamsnap command
StreamSnap — "Capture, replay, and analyze every SSE stream."
StreamSnap — "Capture, replay, and analyze every SSE stream."
streamsplit command
streamthrottle command
streamtransform command
summarizegate command
sy-api command
sy-api — Stockyard API backend.
sy-api — Stockyard API backend.
sy-docs command
sy-docs generates the Stockyard documentation site as static HTML.
sy-docs generates the Stockyard documentation site as static HTML.
sy-keygen command
sy-keygen — License key management for Stockyard products.
sy-keygen — License key management for Stockyard products.
synthgen command
SynthGen — Stockyard Phase 3 P3 product.
SynthGen — Stockyard Phase 3 P3 product.
tableforge command
tenantwall command
TenantWall — "Per-tenant isolation for multi-tenant LLM apps."
TenantWall — "Per-tenant isolation for multi-tenant LLM apps."
tierdrop command
TierDrop — Stockyard Phase 3 P2 product.
TierDrop — Stockyard Phase 3 P2 product.
tokenauction command
tokenmarket command
TokenMarket — Stockyard Phase 3 P3 product.
TokenMarket — Stockyard Phase 3 P3 product.
tokentrim command
TokenTrim — "Never blow a context window again."
TokenTrim — "Never blow a context window again."
toolmock command
toolrouter command
toolshield command
toxicfilter command
ToxicFilter — "Content moderation middleware for LLM outputs."
ToxicFilter — "Content moderation middleware for LLM outputs."
tracelink command
TraceLink — "Distributed tracing for multi-step LLM chains."
TraceLink — "Distributed tracing for multi-step LLM chains."
trainexport command
TrainExport — Stockyard Phase 3 P3 product.
TrainExport — Stockyard Phase 3 P3 product.
usagepulse command
UsagePulse — "Know exactly who's spending what on your LLM calls."
UsagePulse — "Know exactly who's spending what on your LLM calls."
visionproxy command
voicebridge command
VoiceBridge — Stockyard Phase 3 P2 product.
VoiceBridge — Stockyard Phase 3 P2 product.
warmpool command
webhookforge command
webhookrelay command
WebhookRelay — Stockyard Phase 3 P3 product.
WebhookRelay — Stockyard Phase 3 P3 product.
whitelabel command
WhiteLabel — Stockyard Phase 3 P3 product.
WhiteLabel — Stockyard Phase 3 P3 product.
integrations
internal
api
Package api implements the management API for Stockyard products.
Package api implements the management API for Stockyard products.
apiserver
Package apiserver — SQLite-backed persistence for the Stockyard API backend.
Package apiserver — SQLite-backed persistence for the Stockyard API backend.
apps/exchange
Package exchange implements App 6: Exchange — pack marketplace, config sharing, environment sync.
Package exchange implements App 6: Exchange — pack marketplace, config sharing, environment sync.
apps/forge
Package forge implements App 5: Forge — workflow engine, tool registry, triggers, sessions, batch.
Package forge implements App 5: Forge — workflow engine, tool registry, triggers, sessions, batch.
apps/marketing
Package marketing implements the Marketing Ops app — task queue, content calendar, and Chrome agent control plane for Stockyard's go-to-market automation.
Package marketing implements the Marketing Ops app — task queue, content calendar, and Chrome agent control plane for Stockyard's go-to-market automation.
apps/observe
Package observe implements App 2: Observe — analytics, traces, alerts, anomaly detection, cost attribution.
Package observe implements App 2: Observe — analytics, traces, alerts, anomaly detection, cost attribution.
apps/proxy
Package proxy implements App 1: Proxy — core reverse-proxy, middleware chain, provider dispatch.
Package proxy implements App 1: Proxy — core reverse-proxy, middleware chain, provider dispatch.
apps/studio
Package studio implements App 4: Studio — prompt templates, experiments, benchmarks, snapshot tests.
Package studio implements App 4: Studio — prompt templates, experiments, benchmarks, snapshot tests.
apps/trust
Package trust implements App 3: Trust — audit ledger, compliance, evidence packs, replay lab.
Package trust implements App 3: Trust — audit ledger, compliance, evidence packs, replay lab.
auth
Package auth provides user authentication, API key management, and provider key storage.
Package auth provides user authentication, API key management, and provider key storage.
config
Package config handles YAML configuration parsing with environment variable interpolation.
Package config handles YAML configuration parsing with environment variable interpolation.
dashboard
Package dashboard serves the embedded Preact SPA and SSE events.
Package dashboard serves the embedded Preact SPA and SSE events.
engine
Package engine — apibridge mounts the sy-api billing/licensing/cloud/exchange routes onto the unified stockyard binary's HTTP mux.
Package engine — apibridge mounts the sy-api billing/licensing/cloud/exchange routes onto the unified stockyard binary's HTTP mux.
features
Package features implements the pluggable feature layer for Stockyard products.
Package features implements the pluggable feature layer for Stockyard products.
license
Package license handles Stockyard license key generation, validation, and tier enforcement.
Package license handles Stockyard license key generation, validation, and tier enforcement.
platform
Package platform provides the shared App interface and registration pattern for the 6 Stockyard flagship apps (Proxy, Observe, Trust, Studio, Forge, Exchange).
Package platform provides the shared App interface and registration pattern for the 6 Stockyard flagship apps (Proxy, Observe, Trust, Studio, Forge, Exchange).
provider
Package provider defines the interface and types for LLM provider adapters.
Package provider defines the interface and types for LLM provider adapters.
proxy
Package proxy implements the core HTTP reverse proxy server.
Package proxy implements the core HTTP reverse proxy server.
site
Package site embeds and serves the marketing website (homepage, docs, pricing, etc.).
Package site embeds and serves the marketing website (homepage, docs, pricing, etc.).
slog
Package slog provides structured logging for Stockyard.
Package slog provides structured logging for Stockyard.
storage
Package storage manages SQLite persistence for all Stockyard data.
Package storage manages SQLite persistence for all Stockyard data.
toggle
Package toggle provides a runtime middleware toggle registry.
Package toggle provides a runtime middleware toggle registry.
tracker
Package tracker handles token counting, spend calculation, and in-memory counters.
Package tracker handles token counting, spend calculation, and in-memory counters.
Package main implements a Terraform provider for Stockyard.
Package main implements a Terraform provider for Stockyard.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL