Skip to content

stockyard-dev/Stockyard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

397 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

═══ 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.

Before / After

Before Stockyard — your LLM stack:

Your App → OpenAI API
  + LiteLLM (proxy)            — Python + Redis + Postgres
  + Langfuse (observability)   — separate deployment
  + PromptLayer (prompts)      — SaaS, $49/mo
  + custom billing webhook     — you maintain this
  + custom audit logging       — you maintain this
  + custom rate limiter        — you maintain this
= 6 tools, 4 deployments, 3 databases, 2 SaaS subscriptions

After Stockyard:

Your App → Stockyard → OpenAI API
  ✓ proxy + caching + failover
  ✓ cost tracking + alerts
  ✓ prompt templates + A/B tests
  ✓ billing + invoices
  ✓ audit trail + compliance
  ✓ rate limiting + safety
= 1 binary, 1 port, 0 dependencies
# One line to switch
export OPENAI_BASE_URL=http://localhost:4200/v1
# That's it. Your existing code works unchanged.

See It Work in 60 Seconds

Stockyard demo — install, start, and send a request through 66 middleware modules

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

# Start (all services on one port)
stockyard
# → 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 66 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 66 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

Plus 10 more: Billing, Team, Memory, Recall, Copilot, App Builder, Knowledge, Reputation, Governance, Marketing. All 16 run from the same binary on the same port.

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 → [66 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    │  ~25MB binary    │
│  └──────────┘ └──────────┘                  │
└───────────────────────────────────────────────┘
  • Single binary, single port, single process. No orchestration.
  • Embedded SQLite with WAL mode. No external database.
  • 66 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 chain traversal overhead across the full 66-module middleware chain (benchmarks). Total per-request overhead including module logic is <5ms.

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 ~25MB ~200MB Docker image

Security

  • Provider keys encrypted at rest — AES-256-GCM with PBKDF2-derived key (100K iterations)
  • Hash-chained audit ledger — every event cryptographically linked to the previous
  • Passwords — PBKDF2-HMAC-SHA256 with 100K iterations and unique salt
  • No key leakage — provider keys never appear in logs, traces, or API responses
  • Rate limiting — 10 POST/min/IP on public endpoints
  • Webhook verification — Stripe signatures validated, rejects if secret unset
  • SSRF protection — mesh node URLs validated against private IP ranges
  • Security headers — HSTS, CSP, X-Frame-Options, X-Content-Type-Options

Build from Source

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

Requires Go 1.22+. No other dependencies.

Docker

docker build -t stockyard -f Dockerfile.manual .
docker run -p 4200:4200 -e OPENAI_API_KEY=$OPENAI_API_KEY stockyard

Or use docker-compose:

docker compose up

Pricing

Self-hosted is free forever — all 66 modules, all 16 providers, all 16 apps, unlimited requests. Cloud-managed starts at $29/mo (Pro), $99/mo (Team), $299/mo (Enterprise).

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.