GreenOps AI Studio Docs

Technical documentation for the edge LLM gateway.

← Studio OpenAPI

What is GreenOps AI Studio?

GreenOps AI Studio is a multi-tier SaaS platform designed to proxy and optimize LLM workloads through an OpenAI-compatible AI API Gateway. It applies semantic caching on Cloudflare Workers, FinOps telemetry for token spend and carbon footprint, and a PII anonymization API before requests reach Gemini, OpenAI, or a local GPU runtime. Teams use it as a drop-in proxy alternative to calling provider APIs directly when they need cost control, privacy, and greener inference at the edge.

Introduction & architecture

GreenOps AI is an OpenAI-compatible LLM gateway on Cloudflare Workers. Every chat request is authenticated, PII-masked, optionally served from a semantic KV cache, then routed to Gemini, OpenAI, or a local GPU runtime.

Edge Worker

TypeScript proxy at the Cloudflare PoP. OpenAI-compatible POST /v1/chat/completions.

Semantic cache

WASM prompt hash + KV GREENOPS_CACHE. HIT replies skip the GPU and cost $0 / 0 g CO₂.

PII masking

Emails, cards, phones and tax IDs are anonymized before upstream. Count is returned on X-PII-Redacted-Count.

FinOps / ESG

Response headers expose USD saved, CO₂ avoided, cache HIT/MISS and user tier.

  • Cold path (MISS): trim + hash in WASM, call the LLM, write KV, emit FinOps headers.
  • Hot path (HIT): KV read only — typically tens of milliseconds on the same PoP.
  • Failover: Gemini 429/5xx automatically retries then falls back to OpenAI when configured.

Authentication & setup

Protected routes accept the gateway key as Authorization: Bearer <key> or the native header X-Proxy-Auth. For local and sandbox testing use the bootstrap key GreenOpsKey123.

Quick test key

Send Authorization: Bearer GreenOpsKey123 on chat, analytics and audit calls. Paid plans receive a gop_pro_… key after Stripe checkout. Provider keys (Gemini/OpenAI) are optional when the Worker already has server-side credentials.

Gateway authentication headers
HeaderRequiredMeaning
AuthorizationYes*Bearer token. Example: Bearer GreenOpsKey123.
X-Proxy-AuthYes*Equivalent gateway key if you do not send Authorization.
X-User-RoleNoUser (default), FinOps, Compliance, Admin.
X-User-Gemini-KeyNoBring-your-own Gemini key.
X-User-OpenAI-KeyNoBring-your-own OpenAI key.
X-Local-LLM-UrlNoOpenAI-compatible local runtime (Ollama / GPU).
X-Webhook-UrlNoSlack / Teams incoming webhook for spend and security alerts.

Endpoints & API reference

Proxy URL: https://greenops-ai-proxy.copycomp-ai.workers.dev

Proxy URL
https://greenops-ai-proxy.copycomp-ai.workers.dev
POST · Chat Completions
https://greenops-ai-proxy.copycomp-ai.workers.dev/v1/chat/completions
Proxy endpoints on the GreenOps AI gateway
MethodPathAuthPurpose
POST/v1/chat/completionsYesOpenAI-compatible chat (JSON or SSE if stream: true)
GET/healthNoLiveness + WASM engine
GET/v1/healthNoKV / Gemini / OpenAI readiness
GET/v1/analyticsYesFinOps / ESG totals
GET/v1/audit/logsYesEU AI Act audit trail (Compliance / Admin)
POST/v1/webhooks/stripeStripe-SignatureCheckout → Pro key, cancel → Free
GET/v1/openapi.jsonNoOpenAPI 3.0 spec

Chat Completions

POST JSON with model + messages. Testing uses Bearer GreenOpsKey123. Swap in your provisioned key for production.

cURL
curl https://greenops-ai-proxy.copycomp-ai.workers.dev/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer GreenOpsKey123" \
  -d '{
    "model": "gemini-3.5-flash",
    "messages": [{"role": "user", "content": "Hello GreenOps"}]
  }'

Stripe webhooks

Point the Stripe Dashboard endpoint at the URL below. The Worker verifies Stripe-Signature when STRIPE_WEBHOOK_SECRET is set.

POST · Stripe webhook
https://greenops-ai-proxy.copycomp-ai.workers.dev/v1/webhooks/stripe
  • checkout.session.completed issues an active Pro license (gop_pro_…, 100,000 req/month).
  • customer.subscription.deleted deactivates the license and returns the account to Free.
  • Configure the endpoint in Stripe as POST /v1/webhooks/stripe. No browser CORS is required.
cURL · webhook
curl -X POST https://greenops-ai-proxy.copycomp-ai.workers.dev/v1/webhooks/stripe \
  -H "Content-Type: application/json" \
  -H "Stripe-Signature: t=1700000000,v1=…" \
  -d '{"type":"checkout.session.completed","data":{"object":{"customer_email":"dev@acme.com"}}}'

Pricing tiers & quotas

Limits are enforced at the edge. Free is daily + burst; Pro and Business are monthly; Enterprise is unlimited.

GreenOps AI Studio pricing tiers
Plan Price Request limits Features
Free$0/mo1,000 req/day · 30 req/minStandard semantic caching, baseline PII masking, Community & Docs
Pro$29/mo100,000 req/monthPriority processing, real-time ESG/FinOps telemetry, automated PII anonymization
Business$149/mo1,000,000 req/monthESG/FinOps PDF & CSV export, advanced PII rules, priority support
Enterprise$499+/moUnlimitedDedicated Workers & storage, custom ESG audit, 99.9% uptime SLA

Error handling & status codes

The gateway returns JSON errors. Chat quota responses include error.code, error.message and error.upgrade_url.

HTTP status codes returned by the AI gateway
Status Name Typical cause What to do
401UnauthorizedMissing/invalid Bearer or X-Proxy-Auth.Send Authorization: Bearer GreenOpsKey123 (test) or your provisioned key. Check for extra spaces.
429Rate Limit ExceededFree 1,000/day or 30/min; Pro 100k/mo; Business 1M/mo.Wait for Retry-After, or upgrade. Burst resets every 60 seconds.
500Gateway ErrorUnhandled Worker exception or upstream failure after retries.Retry with backoff. Check GET /v1/health. Confirm Gemini/OpenAI keys if the model is cloud-hosted.
  • 403: RBAC blocked the route (for example Audit requires Compliance/Admin) or prompt injection was rejected.
  • 400: malformed JSON, missing messages[], or a required provider key is absent for that model.
  • SSE: send stream: true. Cache is bypassed on streaming responses.