Workflows technical guide

From a designed workflow to governed production

AICost decides, prices and compiles policy. Your app, agent, gateway and cloud run the work. This guide shows how the two connect.

Your app or agent

Claude, Codex, Cursor, your own agent or CI pipeline calls the engines.

AICost engines over MCP

126 deterministic engines price each step, apply cost levers and return policy.

Your gateway and cloud

LiteLLM, Cloudflare AI Gateway, Amazon Bedrock, Azure AI Foundry or Vertex AI enforce the policy and run the models.

Actuals back to AICost

Bills and usage logs flow back so modeled and actual cost are compared and kept as evidence.

1. Connect to the engines

The engines run on the AICost MCP server. Use MCP from an AI client or agent, or the REST endpoint from code and CI. Both need an AICost key.

SurfaceEndpointUse it for
MCP (Streamable HTTP)https://mcp.aicost.ai/mcpPrimary transport for Claude, Codex, Cursor and agents
MCP (legacy SSE)https://mcp.aicost.ai/sseOlder clients
REST, one enginePOST https://mcp.aicost.ai/v1/runApps and back ends
REST, many enginesPOST https://mcp.aicost.ai/v1/run-batchCI gates and portfolios
Authorization header
Authorization: Bearer <your AICost key>

2. The tools you will call

Three catalog tools cover most work. Workflow tools and first-class policy engines are shortcuts for common jobs.

ToolWhat it does
list_enginesLists every engine with its inputs
recommend_engineTakes a plain question and returns the engines that answer it
run_decision_engineRuns one engine: engine_id, inputs, context
Workflow toolsestimate_llm_workload_cost, optimize_existing_workload, design_ai_stack, estimate_multimodal_cost, analyze_workload_portfolio and more
Ledger toolsledger_ingest_actuals, ledger_reconcile, ledger_attribution
Ask which engines fit
{"name": "recommend_engine", "arguments": {"question": "our agent bill doubled last week, need to cap it"}}
Run one engine
{"name": "run_decision_engine", "arguments": {"engine_id": "aicost.cost-firewall", "inputs": {}, "context": {"ledger": true}}}

Empty inputs run an engine on its defaults; every default is listed in the result as an assumption, marked with an asterisk when inferred.

3. What every engine returns

Each call returns the same decision envelope, so an agent can act on it and an auditor can trace it.

  • result: the numbers or decision
  • assumptions and confidence, with the inputs that drove them
  • evidence with dates for every price used
  • warnings for inferred inputs
  • policy_patch: the policy the result implies
  • companion_url: the same scenario in the web calculator
  • engine_version, so a past answer stays reproducible; pricing can be pinned to a date with context.pricing_as_of

4. Run a designed workflow

Design or pick a workflow, then export its engine chain. The chain is an ordered list of run_decision_engine calls, one per step, plus the cost levers that apply.

Pick or design

Start from one of the enterprise workflows or describe your own in the designer.

Price it

Every step is priced by its engine; levers and governance controls are applied.

Export the MCP chain

Download the chain JSON from the Cost and governance tab.

Run it where you work

Give the chain to Claude or your agent, or call /v1/run-batch from code.

Gate releases

Add the CI cost gate so a change that breaks the budget fails the build.

Batch call from code
POST https://mcp.aicost.ai/v1/run-batch
{"runs": [
  {"engine_id": "aicost.rag-pipeline", "inputs": {}},
  {"engine_id": "aicost.hitl-review-cost", "inputs": {}},
  {"engine_id": "aicost.cost-firewall", "inputs": {}}
]}
CI gate (GitHub Actions)
- name: AICost budget check
  uses: aicost-ai/aicost-mcp/cicd@main
  with:
    config: .aicost.json
  env:
    AICOST_API_KEY: ${{ secrets.AICOST_API_KEY }}

5. Enforce policy in your LLM gateway

AICost compiles one gateway-neutral policy and exports it for the gateway you run. Your gateway enforces it; AICost stays out of the request path.

Gateway or cloudWhat you getStatus
LiteLLMProxy config: model list, routing and fallbacks, cache, retries, budgets. Rules LiteLLM has no setting for are kept under x_aicost_policy for your app layer.Built
Cloudflare AI GatewayGateway settings: caching, retries, rate limiting.Built
Amazon BedrockModel access template (approved models), cross-region inference policy.Built
Azure AI FoundryProvisioned throughput spillover to standard deployments.Built
Vertex AIContext caching policy for large repeated prompts.Built
Portkey, KongUse the policy JSON; native exporters are planned.Planned
AICost enforcing proxyOptional proxy in front of LiteLLM that enforces caps itself: emergency stop, rate limit, daily hard cap, per-run caps, soft-cap downgrade.Opt-in

Budget rules in an export are starting values derived from the priced workflow. Review them before you apply them.

6. Connect AWS, Azure and GCP actuals

Modeled cost is only half the answer. Feed actual spend back and AICost compares the two, workload by workload.

SourceHowStatus
AWSLive read-only connection: a CloudFormation role with an External ID lets AICost read Cost Explorer, including a Bedrock breakdown by usage type. CUR 2.0 and Bedrock invocation logs can also be loaded.Live
AzureCost Management daily export (actual or amortized) or FOCUS 1.x export.Export
GCPBigQuery billing export rows, including Vertex AI and GPU compute.Export
Any cloudFOCUS 1.x billing files.Export
LLM gatewaysLiteLLM spend logs for per-team, per-workload cost.Export

Live API connections for Azure and GCP are planned. Exports work today.

7. Keep it governed

The same engines check the workflow on a schedule and keep the record.

  • Governance sweep re-checks prices, models, vendors and spend against your gates
  • An evidence journal keeps a hash-chained record of every finding, decision and policy change
  • Ledger reconcile shows drift between modeled and actual cost, and the savings realized
  • Each control has an AICost governance control number you can cite in audits

8. Worked example: customer support with RAG

A support team answers 60,000 questions a month from product documentation. The designer prices six steps: front door, retrieval, model answer, screening, human review and the cost firewall.

  • MCP chain: rag-pipeline, cost-calculator, guardrail-security-cost, hitl-review-cost, cost-firewall
  • Levers applied by the engines: prompt caching, model routing for routine questions, batching for non-urgent work
  • Policy exported to LiteLLM: routing rules, cache, monthly budget, daily warning and hard stop
  • Actuals: LiteLLM spend logs and the cloud bill flow back; drift over 10% is flagged
  • Governance: grounded answers only, hallucination checks, PII redaction, audit log

Try it on your own workflow

Get a free MCP key, or price a workflow in the designer first.

📖 Data sources & methodology 172 text models · 9 embeddings · 44 vision · 62 audio · 8 vector DBs across 10 vendor pages · last verified 2026-10-18

Methodology

  • All prices are USD per 1 million tokens, current as of 2026-10-18.
  • Vendor-published values have no mark. Inferred/extrapolated values are marked with * and listed below.
  • Batch API discounts are 50% off standard rates across providers that offer Batch mode.
  • Prompt caching discounts vary by provider (typically 80-90% off cached input tokens).
  • Regional data-residency surcharges (Anthropic 1.1x, OpenAI 1.1x, Google regional tiers) are NOT included in base rates.
  • Long-context pricing tiers apply when input exceeds model threshold.
  • Embedding prices are input-only (no output tokens generated).

Primary sources

Last-verified date is the most recent successful daily snapshot (aicost_pricing_snapshots) or, when no snapshot exists yet, the latest successful crawler run (aicost_crawler_runs). 10 of 10 vendors are currently verified. Aggregator services (TokenCost, AI Pricing Guru, etc.) are not listed.

Anthropic
2026-10-18
https://www.anthropic.com/pricing
Daily snapshot since Sep 2023 · 704 days captured
Anthropic Docs
2026-10-18
https://platform.claude.com/docs/en/about-claude/pricing
Daily snapshot since Sep 2023 · 704 days captured
OpenAI
2026-10-18
https://openai.com/api/pricing/
Daily snapshot since Sep 2023 · 705 days captured
Google AI
2026-10-18
https://ai.google.dev/gemini-api/docs/pricing
Daily snapshot since Dec 2023 · 680 days captured
Google Vertex
2026-10-18
https://cloud.google.com/vertex-ai/generative-ai/pricing
Daily snapshot since Dec 2023 · 680 days captured
DeepSeek
2026-10-18
https://api-docs.deepseek.com/quick_start/pricing
Daily snapshot since May 2024 · 619 days captured
xAI
2026-10-18
https://x.ai/api
Daily snapshot since Nov 2024 · 537 days captured
Mistral
2026-10-18
https://mistral.ai/pricing
Daily snapshot since Dec 2023 · 678 days captured
Cohere
2026-10-18
https://cohere.com/pricing
Daily snapshot since Sep 2023 · 704 days captured

Inferred values (marked with * in calculator tables)

Derived from industry conventions, not directly published by the vendor. Typical conventions: cached input = 10% of base (90% off), Batch API = 50% of base (50% off).

Vendor / Model Field Why it’s inferred
Anthropic — Claude Sonnet 4.6 cachedInput Derived at 10% of input rate — Anthropic publishes 90% cache-hit discount on this tier.
Anthropic — Claude Sonnet 4.5 cachedInput Derived at 10% of input rate; same 90% cache-hit convention as Sonnet 4.6.
Anthropic — Claude Sonnet 4.5 batchInput Derived at 50% of standard input — Anthropic documents uniform 50% Batch discount.
Anthropic — Claude Sonnet 4.5 batchOutput Derived at 50% of standard output — Anthropic documents uniform 50% Batch discount.
Anthropic — Claude Haiku 4.5 cachedInput Derived at 10% of input rate — Anthropic 90% cache-hit discount convention.
OpenAI — GPT-5.4 Mini cachedInput Derived at 10% of input — OpenAI documents automatic 90% discount on cache hits across GPT-5.x tier.
OpenAI — GPT-5.4 Nano cachedInput Derived at 10% of input — OpenAI 90% cache-hit convention.
OpenAI — GPT-5.4 Nano batchInput Derived at 50% of input — OpenAI Batch API uniform 50% discount.
OpenAI — GPT-5.4 Nano batchOutput Derived at 50% of output — OpenAI Batch API uniform 50% discount.
OpenAI — GPT-5.4 Pro cachedInput Derived at 10% of input — OpenAI 90% cache-hit convention.
OpenAI — GPT-5.4 Pro batchInput Derived at 50% of input — OpenAI Batch API uniform 50% discount.
OpenAI — GPT-5.4 Pro batchOutput Derived at 50% of output — OpenAI Batch API uniform 50% discount.
OpenAI — GPT-5.2 cachedInput Derived at 10% of input; no residency uplift.
OpenAI — GPT-5.2 batchInput Derived at 50% of input.
OpenAI — GPT-5.2 batchOutput Derived at 50% of output.
OpenAI — GPT-5 cachedInput Derived at 10% of input.
OpenAI — GPT-5 batchInput Derived at 50% of input.
OpenAI — GPT-5 batchOutput Derived at 50% of output.
OpenAI — GPT-5.5 Pro cachedInput Derived at 10% of input — OpenAI does not publish a cached rate for *-pro models; using the family convention.
OpenAI — GPT-5.5 Pro batchInput Derived at 50% of input.
OpenAI — GPT-5.5 Pro batchOutput Derived at 50% of output.
OpenAI — GPT-5.2 Pro cachedInput Derived at 10% of input — pro-tier convention.
OpenAI — GPT-5.2 Pro batchInput Derived at 50% of input.
OpenAI — GPT-5.2 Pro batchOutput Derived at 50% of output.
OpenAI — GPT-5.1 batchInput Derived at 50% of input.
OpenAI — GPT-5.1 batchOutput Derived at 50% of output.
OpenAI — GPT-5 Pro batchInput Derived at 50% of input.
OpenAI — GPT-5 Pro batchOutput Derived at 50% of output.
OpenAI — GPT-5 Nano cachedInput Derived at 10% of input.
OpenAI — GPT-5 Nano batchInput Derived at 50% of input.
OpenAI — GPT-5 Nano batchOutput Derived at 50% of output.
Google — Gemini 3 Flash cachedInput Derived at 10% of input — Google caching discount convention ~90%.
Google — Gemini 3.1 Flash-Lite cachedInput Derived at 10% of input — Google caching convention.
Google — Gemini 3.1 Flash-Lite batchInput Derived at 50% of input — Google Batch API uniform 50% discount.
Google — Gemini 3.1 Flash-Lite batchOutput Derived at 50% of output — Google Batch API uniform 50% discount.
Google — Gemini 2.5 Pro cachedInput Derived at 10% of input.
Google — Gemini 2.5 Flash cachedInput Derived at 10% of input.
Google — Gemini 2.5 Flash-Lite cachedInput Derived at 10% of input — Google caching convention.
Google — Gemini 2.5 Flash-Lite batchInput Derived at 50% of input — Google Batch API uniform 50% discount.
Google — Gemini 2.5 Flash-Lite batchOutput Derived at 50% of output — Google Batch API uniform 50% discount.
xAI — Grok 4 (legacy) cachedInput Extrapolated at 25% of base.

Pricing is cross-verified against the LiteLLM community registry when available. Daily snapshots are kept in aicost_pricing_snapshots; every change is logged to aicost_price_changelog with old & new values for full audit trail. Read the full methodology →