Explore Models →
Microsoft • Compact Reasoning

Phi 4 API Pricing & Rate Card

Complete 2026 developer pricing guide for Phi 4. Benchmark token economics, context window limits, prompt caching discounts, and live inference latency across official provider endpoints.

Input Token Rate
$0.07
per 1M input tokens
Output Token Rate
$0.14
per 1M generated tokens
Context Window
16,384
maximum token buffer
Avg Throughput
135
tokens/sec (typical speed)
Billing Dimension Standard Rate Cached / Optimized Rate Batch (50% Off) Context Window
Input Prompt $0.07 / M $0.04 / M 50% discount (24h SLA) 16,384 tokens
Output Generation $0.14 / M Standard metered 50% discount (24h SLA) Up to max model limit
Tool / Function Calling Standard input tokens Eligible for prefix cache Batch supported Shared context budget

Interactive Monthly Cost Estimator

Estimate your total bill based on prompt size, response volume, and request volume.

Estimated Monthly Bill
$0.00
Calculated using live 2026 rates for Phi 4

Small Language Model Efficiency: Microsoft's 14B Reasoning Powerhouse

Phi-4 is Microsoft's 14-billion parameter Small Language Model (SLM), engineered to deliver frontier-level mathematical and scientific reasoning without the astronomical compute overhead of 70B+ parameter models. Trained on synthetic reasoning datasets and curated textbook-quality corpora, Phi-4 achieves an astounding 84.4% on GSM8K and competitive scores against GPT-4o on STEM benchmarks.

Because of its 14B parameter size, Phi-4 can be self-hosted on a single NVIDIA A10G (24GB) or consumer RTX 4090 GPU in 4-bit quantization, delivering over 70 tokens/second at zero incremental token cost.

Phi-4 Cloud API & Self-Hosted Pricing Matrix

Deployment Provider Input Rate / 1M Output Rate / 1M Monthly Cost (100M Tokens)
Azure AI Studio Serverless $0.15 / 1M $0.60 / 1M $37.50 / mo
RunPod Dedicated GPU (RTX 4090) $0.34 / hr (Unlimited tokens) $0.00 (Local compute) $24.50 / mo (100 hrs run)
Ollama Local Workstation (Mac M2) $0.00 (Local electricity) $0.00 $0.00 / mo

Frequently Asked Questions

What is the token pricing for Phi 4 in 2026?
Phi 4 is billed at $0.07 per million input tokens and $0.14 per million output tokens under standard API tiers.
What is the context window capacity of Phi 4?
Phi 4 supports up to 16,384 tokens, allowing long-document ingestion and extensive conversational history.
Does Phi 4 support prompt caching or batch discounts?
Yes, prompt caching reduces recurring prefix token costs to roughly $0.04 per million tokens for cached blocks.

Related Frontier Showdowns & Hubs

Microsoft Phi-4 Architecture: 14B High-Density Reasoning & Edge Deployment TCO

Microsoft's Phi-4 is a 14-billion-parameter open model that achieves mathematical and logical reasoning scores exceeding earlier 70B models. Trained heavily on synthetic 'textbook-quality' data and curated multi-step reasoning curricula, Phi-4 delivers dense reasoning power in an exceptionally compact footprint. At 14B parameters, Phi-4 can be served in FP16 on a single NVIDIA A10G (24GB) or in 4-bit quantization on consumer hardware (12GB VRAM), making it a prime candidate for edge, on-device, and private enterprise VPC deployments.

Hosting Option Effective Input / 1M Effective Output / 1M VRAM Required Throughput (Tokens/Sec)
Azure AI Studio (Pay-As-You-Go) $0.14 / 1M $0.56 / 1M Managed Cloud Endpoint Serverless auto-scaling
Self-Hosted vLLM (1x RTX 4080) $0.00 (Fixed Hardware) $0.00 ~10.5 GB (4-bit AWQ) 78 t/s (Single stream)
Self-Hosted vLLM (1x A10G 24GB) $0.00 $0.00 ~16.0 GB (8-bit FP8) 95 t/s

Production Pipeline: Ollama & llama.cpp Local Docker Setup

Serving Phi-4 locally with Ollama in Docker with persistent volume storage and GPU offload:

# Run Ollama with Phi-4 on GPU
docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
docker exec -it ollama ollama run phi4

# Query via standard OpenAI-compatible API format
curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "phi4",
    "messages": [{"role": "user", "content": "Explain raft leader election in Python."}]
  }'

Production Best Practices & Edge Guidelines

14B Parameter Edge Architecture & Quantized Production Footprint

Microsoft's Phi-4 represents a milestone in parameter-efficient synthetic data training, delivering mathematical reasoning and logic performance rivaling 70B parameter models within a compact 14B parameter footprint. From an infrastructure perspective, Phi-4 is tailored for cost-effective single-GPU deployments on edge servers, localized workstations, and containerized Kubernetes pods. In FP16 precision, Phi-4 requires 28 GB of VRAM, but when quantized to INT4 via GGUF or AWQ, its memory requirement plummets to just 9.5 GB, allowing it to run smoothly on consumer-grade NVIDIA RTX 4080 (16GB) or Apple Silicon M-series hardware.

Phi-4 Production Deployment Profiles & Hardware Requirements

Format / Precision Weight Footprint Context Window Minimum GPU / Target Tokens / Sec (TPOT)
FP16 Native TensorRT-LLM 28.5 GB 16,384 tokens 1x NVIDIA L40S (48GB) / A100 92 tokens/s
INT8 SmoothQuant 15.2 GB 16,384 tokens 1x NVIDIA RTX 4090 (24GB) 118 tokens/s
Q4_K_M GGUF (Ollama / vLLM) 9.4 GB 8,192 tokens 1x Apple M3 Max / RTX 4070 64 tokens/s

Production Ollama / Docker Local Inference Service

To deploy Phi-4 locally within an internal corporate microservice with zero egress fees, configure a Docker Compose runtime utilizing Ollama with pre-warmed weights:

services:
  phi4-inference:
    image: ollama/ollama:latest
    container_name: phi4-inference-service
    ports:
      - "11434:11434"
    volumes:
      - ./ollama_data:/root/.ollama
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
    environment:
      - OLLAMA_NUM_PARALLEL=4
      - OLLAMA_KEEP_ALIVE=24h

Phi-4 Edge Cluster Scaling & Latency Guardrails

In edge Kubernetes deployments utilizing Triton Inference Server, Phi-4 INT8 processes reasoning prompts with a deterministic P95 latency under 220 milliseconds. When operating on air-gapped on-premise hardware, horizontal pod autoscalers (HPA) should scale replica counts based on GPU duty cycle metrics, maintaining individual card memory utilization below 85% to accommodate bursts in context length.

Phi-4 Triton Inference Dynamic Batching & Memory Pinning

When hosting Phi-4 via NVIDIA Triton Inference Server, enable dynamic batching with a maximum queue delay of 15 milliseconds. Memory pinning reduces host-to-device PCIe transfer overhead by 30%, ensuring sustained high tokens-per-second throughput across concurrent worker threads.

4.8 out of 5
★★★★★
Developer Community Benchmark Rating
Verified across 98 community production token & cost audits
Rate this benchmark: