Phi-4

by Microsoft

Phi-4 is a 14 billion parameter dense decoder-only transformer trained on 9.8 trillion tokens, designed for reasoning-intensive tasks where smaller model size is critical. It exceeds its teacher model on STEM-focused benchmarks, achieving 84.8 on MMLU and 80.4 on MATH, and supports a 16,384 token context window. Built with a data-quality-first approach, Phi-4 strategically incorporates synthetic training data rather than relying solely on organic web content or code. It excels at math problem-solving, code generation, and multi-step reasoning, optimized for memory and compute-constrained environments. The model is trained primarily on English text with multilingual capability (about 8% multilingual data), and follows a chat instruction format. It is fully open-weight and available on Hugging Face, making it accessible for commercial and research applications.

Key info

Input
Output
Features
Context window
16K
Max output
16K
Input price
$0.07 /1M
Output price
$0.14 /1M
  • US residency available
  • Zero data retention via Enterprise
  • No training by default

Available routes

Phi-4 runs on 1 route through the Opper gateway. Compare residency, ZDR, and training posture at a glance β€” full data-handling detail per route below.

ProviderRegionZero data retentionTrainingInputOutput
USEnterpriseNo$0.07$0.14

Training posture across routes: No training on prompts by default.

Data handling per route

Each route hosting Phi-4 has its own privacy posture, residency, and GDPR terms. Postures are maintained by Opper with a last-verification timestamp.

DeepInfra β€” United StatesπŸ‡ΊπŸ‡Έ

Zero data retention is available via Opper Enterprise contract. No training on customer data. US; unknown.

Zero data retention
Available via Opper Enterprise contract.
Training
No training on customer data.
Logging
Limited debug logs
Third-party access
None disclosed
GDPR DPA
No DPA
Transfer mechanism
unknown

Get started

Call Phi-4 through the Opper gateway with one API key. Let your coding agent set it up, or call it directly β€” Opper is drop-in compatible with the OpenAI, Anthropic, and Google AI SDKs.

Set it up with your agent

Copy this and paste it into your coding agent β€” Claude Code, Cursor, Codex, and more β€” and it'll wire up Opper for you.

Or call it directly

import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.OPPER_API_KEY,
baseURL: "https://api.opper.click/v3/compat",
});
const completion = await client.chat.completions.create({
model: "deepinfra/microsoft/phi-4",
messages: [{ role: "user", content: "Hello" }],
});
console.log(completion.choices[0].message.content);

Compare Phi-4 with…

Side-by-side on privacy, EU hosting, pricing, and benchmarks.

Other models from Microsoft

Start building with 300+ models

One API key. Every major provider. Up and running in minutes.

Get startedView Documentation
Phi-4 by Microsoft β€” pricing, benchmarks | Opper AI