Model Ruler Calculate API

The Calculate API from Model Ruler — 12 operation(s) for calculate.

GitHub OpenAPI

Operations 12

POST /calculate/token-counter/ Use when a user asks how many tokens a given text will consume, or needs to… #
POST /calculate/provider-cost-calculator/ Use when a user asks what an LLM workload costs on a specific provider/model… #
POST /calculate/self-host-breakeven-calculator/ Use when a user is deciding between API usage and self-hosted GPU inference at… #
POST /calculate/context-window-planner/ Use when a user needs to know whether a document plus prompt plus output fits… #
POST /calculate/quantization-calculator/ Use when a user is planning to quantize an LLM to fit on smaller hardware #
POST /calculate/fine-tune-roi-calculator/ Use when a user is considering fine-tuning vs prompt engineering #
POST /calculate/eval-cost-calculator/ Use when a user needs to budget an LLM evaluation run #
POST /calculate/observability-cost-calculator/ Use when a user needs to budget LLM observability tooling #
POST /calculate/rag-pipeline-cost-calculator/ Use when a user needs end-to-end RAG cost estimation (embedding + vector store… #
POST /calculate/automation-cost-calculator/ Use for generic or non-agent recurring workflow platform billing across Zapier… #
POST /calculate/agent-workflow-cost-calculator/ Use for automation-platform/iPaaS cost of an AI agent workflow, including… #
POST /calculate/agent-loop-cost-calculator/ Use for LLM inference/reasoning cost per successful multi-step agent task… #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/modelruler-dev:modelruler-dev-calculate-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

modelruler-dev-calculate-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Model Ruler Calculate API
  version: 1.0.4
  description: '12 deterministic AI architecture cost-planning calculators: token counting, provider cost, self-host breakeven, context window fit, quantization, fine-tune ROI, eval cost, observability cost, RAG pipeline cost, agent loop cost, automation/iPaaS cost, and agent workflow orchestration cost. All results include cost range, severity (healthy|moderate|significant|major|critical), interpretation, next step, and chain-aware related tools via dispatcher.'
servers:
- url: https://modelruler.dev
tags:
- name: Calculate
paths:
  /calculate/token-counter/:
    post:
      summary: Use when a user asks how many tokens a given text will consume, or needs to…
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Text content to count tokens for
                tokenizer:
                  type: string
                  enum:
                  - cl100k_base
                  - o200k_base
                  - claude
                  - gemini
                  - llama3
                  - mistral
                  - default
                  description: 'Tokenizer family (default: default)'
                expected_out_tokens:
                  type: number
                  minimum: 0
                  description: Expected output token budget (optional)
              required:
              - text
              examples:
              - text: Summarize the Q3 board deck into five concise bullet points for the exec team.
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateTokenCounter
      x-operation-id-source: derived
  /calculate/provider-cost-calculator/:
    post:
      summary: Use when a user asks what an LLM workload costs on a specific provider/model…
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                tokens_in:
                  type: number
                  minimum: 0
                  description: Input tokens per call
                tokens_out:
                  type: number
                  minimum: 0
                  description: Output tokens per call
                calls_per_month:
                  type: number
                  minimum: 1
                  description: Monthly call volume
                provider:
                  type: string
                  description: Target provider (e.g. anthropic, openai, together)
                model:
                  type: string
                  description: Target model (e.g. claude-sonnet-4-6)
                include_comparison:
                  type: boolean
                  description: Include tier comparison table (default true)
              required:
              - tokens_in
              - tokens_out
              examples:
              - tokens_in: 1200
                tokens_out: 400
                calls_per_month: 100000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateProviderCostCalculator
      x-operation-id-source: derived
  /calculate/self-host-breakeven-calculator/:
    post:
      summary: Use when a user is deciding between API usage and self-hosted GPU inference at…
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                monthly_tokens:
                  type: number
                  minimum: 0
                  description: Monthly output token volume
                api_cost_per_1m_out:
                  type: number
                  minimum: 0
                  description: Current API output cost per 1M tokens
                gpu_provider:
                  type: string
                  description: GPU provider (e.g. runpod, modal)
                gpu_type:
                  type: string
                  description: GPU type (e.g. h100, a100-80gb)
                utilization_pct:
                  type: number
                  minimum: 1
                  maximum: 100
                  description: Expected GPU utilization % (default 60)
                operational_overhead_pct:
                  type: number
                  minimum: 0
                  description: Ops overhead % on GPU cost (default 40)
              required:
              - monthly_tokens
              examples:
              - monthly_tokens: 750000000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateSelfHostBreakevenCalculator
      x-operation-id-source: derived
  /calculate/context-window-planner/:
    post:
      summary: Use when a user needs to know whether a document plus prompt plus output fits…
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                doc_tokens:
                  type: number
                  minimum: 0
                  description: Primary document/content tokens
                overhead_tokens:
                  type: number
                  minimum: 0
                  description: System prompt + few-shot + history (default 2000)
                expected_out_tokens:
                  type: number
                  minimum: 0
                  description: Reserved output budget (default 1000)
                model_context_window:
                  type: number
                  minimum: 1
                  description: Target model context size
                strategy_hint:
                  type: string
                  enum:
                  - truncate
                  - summarize
                  - rag
                  - chunk
                  description: Preferred strategy (optional)
              required:
              - doc_tokens
              - model_context_window
              examples:
              - doc_tokens: 18000
                model_context_window: 200000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateContextWindowPlanner
      x-operation-id-source: derived
  /calculate/quantization-calculator/:
    post:
      summary: Use when a user is planning to quantize an LLM to fit on smaller hardware
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                params_billions:
                  type: number
                  minimum: 0.1
                  description: Model parameter count in billions
                precision_from:
                  type: string
                  enum:
                  - fp32
                  - fp16
                  - bf16
                  - fp8
                  - int8
                  - int6
                  - int5
                  - int4
                  - int3
                  - int2
                  - int1
                  description: Starting precision (default bf16)
                precision_to:
                  type: string
                  enum:
                  - fp32
                  - fp16
                  - bf16
                  - fp8
                  - int8
                  - int6
                  - int5
                  - int4
                  - int3
                  - int2
                  - int1
                  description: Target precision (default int4)
                kv_cache_tokens:
                  type: number
                  minimum: 0
                  description: Max KV cache tokens (default 8192)
                batch_size:
                  type: number
                  minimum: 1
                  description: Serving batch size (default 1)
              required:
              - params_billions
              examples:
              - params_billions: 8
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateQuantizationCalculator
      x-operation-id-source: derived
  /calculate/fine-tune-roi-calculator/:
    post:
      summary: Use when a user is considering fine-tuning vs prompt engineering
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                train_tokens:
                  type: number
                  minimum: 0
                  description: Training tokens (dataset × epochs)
                train_cost_per_1m:
                  type: number
                  minimum: 0
                  description: Training cost per 1M tokens
                base_inference_cost_1m:
                  type: number
                  minimum: 0
                  description: Baseline API output cost per 1M
                finetuned_inference_cost_1m:
                  type: number
                  minimum: 0
                  description: Fine-tuned inference cost per 1M
                monthly_inference_tokens:
                  type: number
                  minimum: 0
                  description: Expected monthly inference volume (output tokens)
                prompt_reduction_pct:
                  type: number
                  minimum: 0
                  maximum: 100
                  description: Prompt size reduction % from eliminating few-shot (default 0)
              required:
              - train_tokens
              - monthly_inference_tokens
              examples:
              - train_tokens: 50000000
                monthly_inference_tokens: 300000000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateFineTuneRoiCalculator
      x-operation-id-source: derived
  /calculate/eval-cost-calculator/:
    post:
      summary: Use when a user needs to budget an LLM evaluation run
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                samples:
                  type: number
                  minimum: 1
                  description: Number of eval samples
                models:
                  type: number
                  minimum: 1
                  description: Candidate models (default 1)
                trials_per_sample:
                  type: number
                  minimum: 1
                  description: Repeats per sample (default 1)
                avg_tokens_in:
                  type: number
                  minimum: 0
                  description: Avg input tokens per sample (default 2000)
                avg_tokens_out:
                  type: number
                  minimum: 0
                  description: Avg output tokens per sample (default 500)
                provider:
                  type: string
                  description: Eval provider (default anthropic)
                model:
                  type: string
                  description: Eval model (default claude-sonnet-4-6)
                judge_enabled:
                  type: boolean
                  description: Enable LLM-as-judge second pass (default false)
                judge_tokens_in:
                  type: number
                  minimum: 0
                  description: Judge input tokens (default 1500)
                judge_tokens_out:
                  type: number
                  minimum: 0
                  description: Judge output tokens (default 200)
              required:
              - samples
              examples:
              - samples: 2000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateEvalCostCalculator
      x-operation-id-source: derived
  /calculate/observability-cost-calculator/:
    post:
      summary: Use when a user needs to budget LLM observability tooling
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                requests_per_day:
                  type: number
                  minimum: 0
                  description: Average daily LLM requests
                avg_log_bytes:
                  type: number
                  minimum: 0
                  description: Avg payload bytes per traced request (default 4096)
                retention_days:
                  type: number
                  minimum: 1
                  description: Retention in days (default 30)
                provider:
                  type: string
                  enum:
                  - langsmith
                  - langfuse
                  - helicone
                  - portkey
                  - arize
                  - braintrust
                  description: Observability provider
              required:
              - requests_per_day
              - provider
              examples:
              - requests_per_day: 50000
                provider: langsmith
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateObservabilityCostCalculator
      x-operation-id-source: derived
  /calculate/rag-pipeline-cost-calculator/:
    post:
      summary: Use when a user needs end-to-end RAG cost estimation (embedding + vector store…
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                queries_per_day:
                  type: number
                  minimum: 0
                  description: User query volume per day
                corpus_tokens:
                  type: number
                  minimum: 0
                  description: Indexed corpus size in tokens
                chunk_size_tokens:
                  type: number
                  minimum: 64
                  description: Avg chunk size (default 512)
                chunks_retrieved:
                  type: number
                  minimum: 1
                  description: Chunks per query (default 5)
                embedding_provider:
                  type: string
                  enum:
                  - openai-3-small
                  - openai-3-large
                  - voyage-3
                  - voyage-3-lite
                  - cohere-embed-v3
                  - google-text-embed-004
                  description: Embedding model
                vector_store:
                  type: string
                  enum:
                  - pinecone
                  - weaviate
                  - qdrant
                  - chroma
                  - turbopuffer
                  description: Vector store
                generator_provider:
                  type: string
                  description: Generator LLM provider (default anthropic)
                generator_model:
                  type: string
                  description: Generator model (default claude-sonnet-4-6)
                question_tokens:
                  type: number
                  minimum: 0
                  description: Avg question tokens (default 100)
                answer_tokens:
                  type: number
                  minimum: 0
                  description: Avg answer tokens (default 400)
                reindex_fraction_per_month:
                  type: number
                  minimum: 0
                  maximum: 1
                  description: Fraction of corpus re-embedded per month (default 0.1)
              required:
              - queries_per_day
              - corpus_tokens
              examples:
              - queries_per_day: 5000
                corpus_tokens: 25000000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateRagPipelineCostCalculator
      x-operation-id-source: derived
  /calculate/automation-cost-calculator/:
    post:
      summary: Use for generic or non-agent recurring workflow platform billing across Zapier…
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                workflow_runs_per_month:
                  type: number
                  minimum: 0
                  description: Workflow/scenario runs per month
                billable_steps_per_run:
                  type: number
                  minimum: 1
                  description: Billable actions/modules per run (default 5)
                make_modules_per_run:
                  type: number
                  minimum: 1
                  description: Make module actions per scenario run; defaults to billable_steps_per_run
              required:
              - workflow_runs_per_month
              examples:
              - workflow_runs_per_month: 120000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateAutomationCostCalculator
      x-operation-id-source: derived
  /calculate/agent-workflow-cost-calculator/:
    post:
      summary: Use for automation-platform/iPaaS cost of an AI agent workflow, including…
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                agent_runs_per_month:
                  type: number
                  minimum: 0
                  description: Agent workflow runs per month
                app_actions_per_run:
                  type: number
                  minimum: 0
                  description: Downstream app actions per agent run (default 3)
                mcp_tool_calls_per_run:
                  type: number
                  minimum: 0
                  description: MCP tool calls per agent run (default 1)
                make_modules_per_run:
                  type: number
                  minimum: 1
                  description: Make modules per run; defaults to app actions + MCP calls
              required:
              - agent_runs_per_month
              examples:
              - agent_runs_per_month: 20000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateAgentWorkflowCostCalculator
      x-operation-id-source: derived
  /calculate/agent-loop-cost-calculator/:
    post:
      summary: Use for LLM inference/reasoning cost per successful multi-step agent task…
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                tasks_per_month:
                  type: number
                  minimum: 0
                  description: Tasks attempted per month
                steps_per_task:
                  type: number
                  minimum: 1
                  description: Avg reasoning steps per task (default 5)
                tool_calls_per_step:
                  type: number
                  minimum: 0
                  description: Avg tool invocations per step (default 2)
                avg_tokens_in_per_turn:
                  type: number
                  minimum: 0
                  description: Avg input tokens per turn (default 3000)
                avg_tokens_out_per_turn:
                  type: number
                  minimum: 0
                  description: Avg output tokens per turn (default 400)
                success_rate:
                  type: number
                  minimum: 0.01
                  maximum: 1
                  description: Task success rate 0-1 (default 0.7)
                provider:
                  type: string
                  description: LLM provider (default anthropic)
                model:
                  type: string
                  description: LLM model (default claude-sonnet-4-6)
                context_growth_factor:
                  type: number
                  minimum: 1
                  description: Multiplier on input tokens as conversation grows (default 1.4)
              required:
              - tasks_per_month
              examples:
              - tasks_per_month: 60000
      responses:
        '200':
          description: Calculation result with 9-field MCP contract
        '400':
          description: Validation error
      tags:
      - Calculate
      operationId: postCalculateAgentLoopCostCalculator
      x-operation-id-source: derived