Skip to content
Phi 4 Mini Instruct logo

Phi 4 Mini Instruct

Verified

Compact 3.8B open-weight model for efficient instruction following.

MicrosoftLanguage ModelsOpen
Model page
Updated 2026-06-14

About Phi 4 Mini Instruct

Built with 3.8 billion parameters, the model uses a transformer architecture optimized for text-only inputs and outputs. Its 131k token context window enables processing of long documents or multi-turn conversations without truncation. As an open-weight release, it supports local deployment and fine-tuning by developers.

The design emphasizes resource efficiency while maintaining strong instruction adherence across varied prompts. This makes it suitable for edge devices, research experiments, and production systems that require low latency. Typical usage includes chat interfaces, summarization of lengthy texts, and lightweight reasoning workflows.

Capabilities

Instruction following
Logical and mathematical reasoning
Code generation and debugging
Long-context comprehension
Text summarization and analysis
Multi-turn conversation

How Phi 4 Mini Instruct compares

Phi 4 Mini Instruct (striped bar) vs other language models on intelligence, speed and price.

Price

USD per 1M output tokens · Lower is better · Phi 4 Mini Instruct ranks #19 of 72

$0.27
Qwen3 Coder 30B A3B Instruct
$0.28
Qwen3 32B
$0.30
Step 3.5 Flash
$0.30
MiMo-V2-Flash
$0.30
gpt-oss-safeguard-20b
$0.34
DeepSeek V3.2
$0.35
Phi 4 Mini Instruct
$0.40
GLM 4.7 Flash
$0.40
Llama 3.3 Nemotron Super 49B V1.5
$0.40
Hermes 4 70B
$0.40
Qwen3 30B A3B Thinking 2507
$0.41
DeepSeek V3.2 Exp
$0.45
Nemotron 3 Super

Sources: Artificial Analysis (intelligence, speed) · OpenRouter (price).

Best for

Code Generation and Debugging

Phi 4 Mini Instruct excels at writing, reviewing, and fixing code in multi-file projects by leveraging its dedicated code generation and debugging capabilities.

Long Document Analysis

The model handles extended inputs effectively for summarizing reports, extracting key points, and performing in-depth analysis across large texts.

Step-by-Step Reasoning Tasks

It supports logical and mathematical problem solving through clear instruction following in multi-turn educational or technical dialogues.

Strengths & limitations

Strengths

  • +Strong performance for compact size
  • +Efficient inference on limited hardware
  • +Handles extended context windows effectively
  • +Clear and structured responses

Limitations

  • Smaller knowledge cutoff than large models
  • Text-only modality
  • May struggle with highly nuanced or creative tasks

Cost calculator

Estimate what Phi 4 Mini Instruct would cost for your usage.

$0.00026
per request
$2.55
estimated / month

Based on Phi 4 Mini Instruct's $0.08/1M input · $0.35/1M output. Estimate only — actual cost varies by provider and caching.

Quick start

OpenRouter's API is OpenAI-compatible — most SDKs work by just swapping the base URL. Only the model slug changes between models.

JavaScript · openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://openrouter.ai/api/v1",
  apiKey: process.env.OPENROUTER_API_KEY,
});

const completion = await client.chat.completions.create({
  model: "microsoft/phi-4-mini-instruct",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(completion.choices[0].message.content);

Model slug: microsoft/phi-4-mini-instruct

Editor's verdict

Our take on Phi 4 Mini Instruct

Phi 4 Mini Instruct is Microsoft's open-weight language models with a 131K-token context window.

At $0.35 per 1M output tokens, it is very cost-efficient for its class.

As an open-weight model you can self-host it or call it through a hosted API.

Best suited to strong performance for compact size and efficient inference on limited hardware.

Did you find this helpful?

Frequently asked questions

The model provides a context window of 131072 tokens.

User reviews

Real, verified reviews from the community shape this model's rating.

Loading reviews…

Sign in to review

Promote Phi 4 Mini Instruct

Add this badge to your website, or share the tool.

DFeatured on DhanasviPhi 4 Mini Instruct 1