We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.
Microsoft: Phi 4
microsoft/phi-4Try Microsoft: Phi 4 now
Runs on your balance at the prices above. New accounts start with free usage.
One API. Every model.
Session cost $0.00
Settings
Advanced parameters
Microsoft: Phi 4 at a glance
- Input price is 84% lower than the median of 434 Text models.
- Supports structured JSON output with a schema.
- A typical request (1,000 input / 500 output tokens) costs about $0.000490.
About Microsoft: Phi 4
Microsoft Phi 4 is a text model from Microsoft, released on 10 January 2025 and identified on api14 as microsoft/phi-4. It comes from Microsoft Research, the group behind the Phi family, and the provider describes it as a 14 billion parameter model built to perform well on complex reasoning tasks while operating efficiently in situations with limited memory or where quick responses are needed. It sits in the text category, so it is aimed at language work rather than images or audio.
The model accepts text input and returns text output. It has a context window of 16,384 tokens and a maximum output of 14,745 tokens, with a knowledge cutoff of 30 June 2024. Its supported request parameters are frequency_penalty, logit_bias, max_tokens, min_p, presence_penalty, repetition_penalty, response_format, seed, stop, structured_outputs, temperature, top_k and top_p. That combination covers the usual sampling controls plus structured outputs, which matters if you need the reply to conform to a schema rather than arrive as free text.
Those capabilities point to a few practical uses. Reasoning-heavy prompts such as multi-step analysis, math-style problems and logic questions are the stated focus, so it suits tasks where the model has to work through intermediate steps before answering. Because it is designed to run efficiently with limited memory and to respond quickly, it also fits latency-sensitive or resource-constrained deployments, including local or self-hosted setups where a smaller model is preferable to a very large one. Structured outputs and response_format make it usable for extraction and classification, where you want JSON or another defined shape back. The 16,384 token context supports moderately long inputs such as documents, transcripts or code files, though it is not a long-context model.
You call it through api14's OpenAI-compatible API using the model id microsoft/phi-4. Point your existing OpenAI client at the api14 base URL, keep the chat completions style of request, and set the model field to that id. You can pass any of the parameters listed above in the request body, so temperature, top_p, top_k, min_p, repetition_penalty, frequency_penalty, presence_penalty, logit_bias, seed, stop, max_tokens, response_format and structured_outputs are all available to tune or constrain the response.
The main constraint to keep in mind is the context window. At 16,384 tokens, with up to 14,745 tokens of output, it is a good fit for focused prompts and moderate documents, but if your input is a large codebase, a long book or a lengthy conversation history, a model with a larger context will serve you better. The knowledge cutoff of 30 June 2024 also means the model has no awareness of events after that date, so anything time-sensitive needs to be supplied in the prompt.
How to call the Microsoft: Phi 4 API
- Create an API key in your dashboard.
- Install the official openai SDK for your language.
- Set baseURL to https://api14.com/api/v1 and model to "microsoft/phi-4".
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.chat.completions.create({
"model": "microsoft/phi-4",
"messages": [
{
"role": "user",
"content": "Explain vector databases in two sentences."
}
]
});
console.log(result.choices[0].message.content);
Supported parameters
frequency_penaltylogit_biasmax_tokensmin_ppresence_penaltyrepetition_penaltyresponse_formatseedstopstructured_outputstemperaturetop_ktop_pSpecifications
- Context length
- 16,384
- Max output
- 14,745
- Input
- text
- Output
- text
- Knowledge cutoff
- 2024-06-30
Requests on api14 · last 7 days
Microsoft: Phi 4: frequently asked questions
- How much does the Microsoft: Phi 4 API cost?
- Microsoft: Phi 4 costs Input $0.25 / 1M tokens. It is charged from your USD balance only for successful requests; failed requests are free.
- What is the context window of Microsoft: Phi 4?
- Microsoft: Phi 4 reads up to 16,384 tokens per request: prompt, history and documents together. It writes up to 14,745 output tokens per response.
- What can Microsoft: Phi 4 do?
- Microsoft: Phi 4 accepts text and returns text. It supports structured JSON output.
- How do I call Microsoft: Phi 4 from my code?
- Point any OpenAI SDK at https://api14.com/api/v1 and set the model to "microsoft/phi-4". No other code changes. Copy a ready example from the code panel on this page.
- What are alternatives to Microsoft: Phi 4?
- Comparable Text models at a similar price: Qwen: Qwen3.5-9B, DeepSeek: DeepSeek V4 Flash Latest, Z.ai: GLM Flash Latest. Each runs through the same API key, so switching is one string.
Microsoft: Phi 4 community
New topicThis community has no topics yet. Open the first one about Microsoft: Phi 4.