NewKimi K3.1 Pro is now availableTry it now
GuidePublished 7 min read

Cheapest LLM API in 2026: Verified Per-1M Rates & Cache Math

Compare the cheapest LLM API models per 1M fresh, cached, and output tokens on Inference.net with 40-turn coding-agent and extraction cost math.

Inference.net

What is the cheapest LLM API in 2026?

On Inference.net, the cheapest LLM API endpoints start at $0.027 per 1M input tokens for small classification models (llama-3.2-1b-instruct) and $0.03 input / $0.15 output per 1M tokens for dedicated HTML-to-JSON extraction (inference-net/schematron-v2-turbo). For 1M-context coding agents with tool calling and vision, deepseek-v4.1-flash-1017 costs $0.08 fresh input, $0.007 cached input reads, and $0.635 output per 1M tokens with 0% markup pay-as-you-go billing and default Zero Data Retention.

Headline input pricing alone rarely picks the cheapest API for production traffic. In multi-turn coding agents, 80% to 90% of input tokens are repeated context, so cached read rates and output token rates decide the real monthly invoice.

Live verified per-1M-token pricing (2026-12-06)

Every model ID, context limit, and per-1M-token rate below was verified directly from GET https://api.inference.net/v1/models on 2026-12-06 (the API returns per-token prices; multiply by 1,000,000 for per-1M rates):

Model IDContextMax outputFresh input ($/1M)Cached read ($/1M)Output ($/1M)Tool callingBest workload
llama-3.2-1b-instruct60,00060,000$0.027N/A$0.201NoSimple tagging and routing
inference-net/schematron-v2-turbo128,0008,192$0.03$0.03$0.15NoHigh-volume HTML and JSON extraction
gemma-3-4b-it131,0728,192$0.05N/A$0.10NoLightweight text and image classification
inference-net/schematron-v2-small128,0004,096$0.05$0.05$0.23NoComplex schema-strict extraction
deepseek-v4.1-flash-10171,040,000393,216$0.08$0.007$0.635YesCoding agents, RAG, and vision
glm-5.31,048,576943,718$0.084$0.079$3.00YesDeep reasoning and long-output synthesis
minimax-m3.1-flash1,000,000524,288$0.10$0.005$0.50YesUltra-low-cost coding loops and chat
glm-5.3-flash1,048,576262,144$0.10$0.03$0.35YesOutput-heavy text, image, and video
nemotron-3-super262,144262,144$0.102N/A$0.48YesGeneral tool-calling pipelines
moonshotai/kimi-k31,048,5761,048,576$0.245$0.224$15.00YesInput-heavy synthesis with 1M output ceiling
deepseek-v4.1-flash-1017-cyber1,040,000393,216$0.30$0.007$1.00YesAuthorized AppSec and pentesting (Privileged Access)
moonshotai/kimi-k3.1-pro1,048,5761,048,576$1.80$0.198$9.00YesFrontier open-weight agentic architecture

All models above accept OpenAI /v1/chat/completions, /v1/responses, and native Anthropic /v1/messages with one API key. Browse the full model catalog or inspect DeepSeek API pricing for every DeepSeek snapshot.

Why cheapest input price does not equal cheapest monthly bill

Three pricing traps invert the rankings once real traffic hits production:

  1. Cached read discounts dominate multi-turn agents. deepseek-v4.1-flash-1017 discounts cached reads by 91.3% ($0.08 down to $0.007/1M), and minimax-m3.1-flash discounts cached reads by 95.0% ($0.10 down to $0.005/1M). A model with cheap uncached input and minimal caching discount can cost more by turn five.
  2. Output token pricing carries the bill when caching works. Once 85% of input tokens hit cache, output tokens often represent 50% to 75% of total spend. For example, glm-5.3 has a very low $0.084/1M fresh input rate, but its $3.00/1M output rate makes it 4.6x pricier per coding-agent session than deepseek-v4.1-flash-1017.
  3. Output-heavy vs. input-heavy ratios flip model pairs. moonshotai/kimi-k3 ($0.245 fresh input, $15.00 output) is cheaper than moonshotai/kimi-k3.1-pro ($1.80 fresh input, $0.198 cached, $9.00 output) on single-turn, input-heavy summarization. On long multi-turn coding sessions with 85% cache hits, moonshotai/kimi-k3.1-pro actually costs less per session because its cached read and output rates are lower.

Workload 1: 40-turn coding-agent session math

This calculation uses the exact shape of our Coding Agent preset: 40 turns per session, 14,000 average input tokens per turn (560K total input: 84K fresh + 476K cached at an 85% cache hit rate), and 900 average output tokens per turn (36K total output). The rightmost column scales that workload to 750,000 requests/month (18,750 sessions: 1,575M fresh input, 8,925M cached reads, and 675M output tokens).

Model IDFresh input (84K)Cached read (476K)Output (36K)Cost per 40-turn sessionMonthly (750K reqs)
minimax-m3.1-flash$0.0084$0.0024$0.0180$0.0288$539.63
deepseek-v4.1-flash-1017$0.0067$0.0033$0.0229$0.0329$617.10
glm-5.3-flash$0.0084$0.0143$0.0126$0.0353$661.50
deepseek-v4.1-flash-1017-cyber$0.0252$0.0033$0.0360$0.0645$1,209.98
glm-5.3$0.0071$0.0376$0.1080$0.1527$2,862.38
moonshotai/kimi-k3.1-pro$0.1512$0.0942$0.3240$0.5694$10,677.15
moonshotai/kimi-k3$0.0206$0.1066$0.5400$0.6672$12,510.08
claude-sonnet-4-6 (reference)$0.2520$0.1428$0.5400$0.9348$17,527.50

Key takeaways from the coding-agent math:

  • Under four cents per 40-turn session: minimax-m3.1-flash ($0.0288), deepseek-v4.1-flash-1017 ($0.0329), and glm-5.3-flash ($0.0353) run 26x to 32x cheaper than claude-sonnet-4-6 ($0.9348).
  • Caching cuts DeepSeek session cost in half: Without prompt caching, that same 40-turn session on deepseek-v4.1-flash-1017 rises from $0.0329 to $0.0677 (2.06x higher). On deepseek-v4.1-flash-1017-cyber, caching cuts session cost by 3.16x ($0.0645 vs $0.2040).
  • Interactive modeling: Adjust turn count, cache hit rate, and monthly request volume in the LLM Pricing Calculator (Coding Agent preset) or isolate prefix-cache savings in the Prompt Cache Calculator.

Workload 2: High-volume HTML and JSON extraction math

Structured extraction pipelines process many short documents with a repeated system prompt and JSON schema. Here is the cost for 100,000 documents with 3,500 input tokens per document (60% shared prompt/schema = 140M fresh input + 210M cached reads) and 350 output tokens per document (35M output):

Model IDFresh input (140M)Cached read (210M)Output (35M)Total for 100K docsCost per 1,000 docs
inference-net/schematron-v2-turbo$4.20$6.30$5.25$15.75$0.16
inference-net/schematron-v2-small$7.00$10.50$8.05$25.55$0.26
glm-5.3-flash$14.00$6.30$12.25$32.55$0.33
minimax-m3.1-flash$14.00$1.05$17.50$32.55$0.33
deepseek-v4.1-flash-1017$11.20$1.47$22.23$34.90$0.35

Even though inference-net/schematron-v2-turbo bills cached and fresh input at the same $0.03/1M rate, its ultra-low base input and $0.15/1M output rate make it the cheapest option by more than 2x for pure text/HTML-to-JSON extraction. Switch to glm-5.3-flash or deepseek-v4.1-flash-1017 when extraction also requires image inputs or tool calling (see Schematron docs and Structured outputs).

How to keep effective API costs low in production

  1. Match prompt caching rules to each model family:
    • deepseek-v4.1-flash-1017 and deepseek-v4.1-flash-1017-cyber: Automatic prefix caching. Omit prompt_cache_key and keep everything before the changing user turn byte-identical.
    • glm-5.3 and glm-5.3-flash: Pass a stable prompt_cache_key per conversation or shared system prefix alongside byte-identical leading messages.
    • moonshotai/kimi-k3 and moonshotai/kimi-k3.1-pro: Automatic implicit prefix caching on stable leading prefixes.
  2. Disable reasoning on deterministic ETL tasks: deepseek-v4.1-flash-1017 thinks by default, and thinking tokens bill at the output rate. For classification or JSON extraction where reasoning adds cost without accuracy gain, pass "reasoning_effort": "none" (see Reasoning docs).
  3. Route by task tier on one API key: Send scraping and JSON parsing to inference-net/schematron-v2-turbo, daily coding loops to deepseek-v4.1-flash-1017, and complex architectural refactors to glm-5.3 or moonshotai/kimi-k3.1-pro.
  4. Use direct serverless providers to avoid aggregator fees: Calling direct GPU hosts avoids marketplace credit fees and keeps prefix-cache stickiness high across turns (see Inference.net vs OpenRouter and Provider comparisons).

Copy-paste Python example with live cost accounting

Create an API key in API keys (or register here) and run this script to measure cached tokens and exact request cost:

python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.inference.net/v1",  # or https://us.api.inference.net/v1
    api_key=os.environ["INFERENCE_API_KEY"],
)

MODEL = "deepseek-v4.1-flash-1017"
RATES_PER_1M = {"input": 0.08, "cached": 0.007, "output": 0.635}

stream = client.chat.completions.create(
    model=MODEL,
    stream=True,
    stream_options={"include_usage": True},
    messages=[
        {"role": "system", "content": "You are a concise systems engineer."},
        {"role": "user", "content": "Write a Go token-bucket rate limiter in 30 lines."},
    ],
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
    if chunk.usage:
        prompt_tokens = chunk.usage.prompt_tokens
        cached_tokens = getattr(chunk.usage.prompt_tokens_details, "cached_tokens", 0) or 0
        fresh_tokens = max(0, prompt_tokens - cached_tokens)
        output_tokens = chunk.usage.completion_tokens
        cost_usd = (
            fresh_tokens * RATES_PER_1M["input"]
            + cached_tokens * RATES_PER_1M["cached"]
            + output_tokens * RATES_PER_1M["output"]
        ) / 1_000_000
        print(f"\n[cost] fresh={fresh_tokens} cached={cached_tokens} out={output_tokens} usd=${cost_usd:.6f}")

Related reading & models

Back to all guides