---
title: Microsoft: Phi 4 Mini Instruct | Text Generation | ModelsLab
description: Build with Microsoft: Phi 4 Mini Instruct API by Microsoft. Text generation, chat, code, and reasoning. Pay-per-use. Free tier.
url: https://modelslab.com/models/microsoft/microsoft-phi-4-mini-instruct/api.md
canonical: https://modelslab.com/models/microsoft/microsoft-phi-4-mini-instruct/api.md
type: product
component: Playground/LLM/Index
generated_at: 2026-05-05T20:15:37.766280Z
---

Microsoft: Phi 4 Mini Instruct
---

 [LLMs.txt](https://modelslab.com/models/open_router/microsoft-phi-4-mini-instruct/llms.txt) [.md](https://modelslab.com/models/microsoft/microsoft-phi-4-mini-instruct.md)

microsoft-phi-4-mini-instruct microsoft Closed Source Model $0.215000 / call

Microsoft: Phi 4 Mini Instruct
---

Choose a prompt below to get started or type your own message

 Explain quantum computing in simple terms

 Write a Python function to sort a list

 Create a marketing email for a SaaS product

 Compare REST vs GraphQL APIs

Send

### Microsoft: Phi 4 Mini Instruct

microsoft microsoft-phi-4-mini-instruct

Copy model ID

PricingInput $0.08 / 1M tokens

Output $0.35 / 1M tokens

API EndpointsOpenAI Compatible

`https://modelslab.com/api/v7/llm/chat/completions`Endpoint

Anthropic Compatible

`https://modelslab.com/api/v7/llm/v1/messages`Messages

`https://modelslab.com/api/v7/llm/v1/messages/count_tokens`Count Tokens

`https://modelslab.com/api/v7/llm/v1/models`Models

Use with Claude Code

cURL Example

ParametersSystem MessageYou are a helpful AI assistant specialized in providing accurate and detailed responses.

Temperature0.7

Max Tokens1000

Top P0.9

Frequency Penalty0

Presence Penalty0

Model Info

Support

Related Models
---

Discover similar models you might be interested in

 [View all LLM Models](https://modelslab.com/models?feature=llmaster)

[W2](https://modelslab.com/models/open_router/microsoft-wizardlm-2-8x22b)[Open Router](https://modelslab.com/models/open_router)

 [WizardLM-2 8x22B

Closed Source Model](https://modelslab.com/models/open_router/microsoft-wizardlm-2-8x22b)

[ER](https://modelslab.com/models/together_ai/togethercomputer-EssentialAI-RNJ-1-Instruct)[Together AI](https://modelslab.com/models/together_ai)

 [EssentialAI Rnj-1 Instruct

Closed Source Model](https://modelslab.com/models/together_ai/togethercomputer-EssentialAI-RNJ-1-Instruct)

[ER](https://modelslab.com/models/together_ai/essentialai-rnj-1-instruct)[Together AI](https://modelslab.com/models/together_ai)

 [EssentialAI Rnj-1 Instruct

Closed Source Model](https://modelslab.com/models/together_ai/essentialai-rnj-1-instruct)

[QQ](https://modelslab.com/models/open_router/qwen-qwen3-vl-235b-a22b-instruct)[Open Router](https://modelslab.com/models/open_router)

 [Qwen: Qwen3 VL 235B A22B Instruct

Closed Source Model](https://modelslab.com/models/open_router/qwen-qwen3-vl-235b-a22b-instruct)

[G4](https://modelslab.com/models/together_ai/zai-org-GLM-4.7)[Together AI](https://modelslab.com/models/together_ai)

 [GLM 4.7 Fp8

Closed Source Model](https://modelslab.com/models/together_ai/zai-org-GLM-4.7)

[Q2](https://modelslab.com/models/together_ai/Qwen-Qwen2.5-Coder-32B-Instruct)[Together AI](https://modelslab.com/models/together_ai)

 [Qwen 2.5 Coder 32B Instruct

Closed Source Model](https://modelslab.com/models/together_ai/Qwen-Qwen2.5-Coder-32B-Instruct)

[GG](https://modelslab.com/models/open_router/google-gemini-3.1-pro-preview-customtools)[Open Router](https://modelslab.com/models/open_router)

 [Google: Gemini 3.1 Pro Preview Custom Tools

Closed Source Model](https://modelslab.com/models/open_router/google-gemini-3.1-pro-preview-customtools)

[XG](https://modelslab.com/models/open_router/x-ai-grok-code-fast-1)[Open Router](https://modelslab.com/models/open_router)

 [xAI: Grok Code Fast 1

Closed Source Model](https://modelslab.com/models/open_router/x-ai-grok-code-fast-1)

[OG](https://modelslab.com/models/open_router/openai-gpt-5.3-codex)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: GPT-5.3-Codex

Closed Source Model](https://modelslab.com/models/open_router/openai-gpt-5.3-codex)

[MM](https://modelslab.com/models/open_router/minimax-minimax-m2.5-free)[Open Router](https://modelslab.com/models/open_router)

 [MiniMax: MiniMax M2.5 (free)

Closed Source Model](https://modelslab.com/models/open_router/minimax-minimax-m2.5-free)

[ML](https://modelslab.com/models/together_ai/meta-llama-Meta-Llama-3.1-8B-Instruct-Turbo)[Together AI](https://modelslab.com/models/together_ai)

 [Meta Llama 3.1 8B Instruct Turbo

Closed Source Model](https://modelslab.com/models/together_ai/meta-llama-Meta-Llama-3.1-8B-Instruct-Turbo)

[N3](https://modelslab.com/models/together_ai/nim-nvidia-llama-3.1-nemotron-70b-instruct)[Together AI](https://modelslab.com/models/together_ai)

 [nim/nvidia/llama-3.1-nemotron-70b-instruct

Closed Source Model](https://modelslab.com/models/together_ai/nim-nvidia-llama-3.1-nemotron-70b-instruct)

[OO](https://modelslab.com/models/open_router/openai-o1-pro)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: o1-pro

Closed Source Model](https://modelslab.com/models/open_router/openai-o1-pro)

[AA](https://modelslab.com/models/together_ai/arize-ai-qwen-2-1.5b-instruct)[Together AI](https://modelslab.com/models/together_ai)

 [Arize AI Qwen 2 1.5B Instruct

Closed Source Model](https://modelslab.com/models/together_ai/arize-ai-qwen-2-1.5b-instruct)

[XG](https://modelslab.com/models/open_router/x-ai-grok-4.3)[Open Router](https://modelslab.com/models/open_router)

 [xAI: Grok 4.3

Closed Source Model](https://modelslab.com/models/open_router/x-ai-grok-4.3)

[II](https://modelslab.com/models/open_router/inflection-inflection-3-productivity)[Open Router](https://modelslab.com/models/open_router)

 [Inflection: Inflection 3 Productivity

Closed Source Model](https://modelslab.com/models/open_router/inflection-inflection-3-productivity)

[H3](https://modelslab.com/models/together_ai/Hcompany-Holo3-35B-A3B)[Together AI](https://modelslab.com/models/together_ai)

 [Holo3 35B A3b

Closed Source Model](https://modelslab.com/models/together_ai/Hcompany-Holo3-35B-A3B)

[MM](https://modelslab.com/models/open_router/mistralai-ministral-3b-2512)[Open Router](https://modelslab.com/models/open_router)

 [Mistral: Ministral 3 3B 2512

Closed Source Model](https://modelslab.com/models/open_router/mistralai-ministral-3b-2512)

About Microsoft: Phi 4 Mini Instruct
---

Phi-4-mini-instruct is a lightweight open model built upon synthetic data and filtered publicly available websites - with a focus on high-quality, reasoning dense data. The model belongs to the Phi-4...

### Technical Specifications

Model IDmicrosoft-phi-4-mini-instructCategoryLLM ModelsTaskText GenerationPrice$0.215000 per million tokensAddedMay 5, 2026

### Key Features

- Chat completion and multi-turn conversation API
- Streaming response with token-by-token output
- Function calling and tool use support
- System prompts and role-based messaging
- JSON mode and structured output

### Quick Start

Integrate Microsoft: Phi 4 Mini Instruct into your application with a single API call. Get your API key from the [pricing page](https://modelslab.com/pricing) to get started.

PythonJavaScriptcURLPHP

```
<code>import requests
import json

url = "https://modelslab.com/api/v7/llm/chat/completions"

headers = {
    "Content-Type": "application/json"
}

data = {
        "model_id": "microsoft-phi-4-mini-instruct",
        "messages": [
            {
                "role": "user",
                "content": "Hello!"
            }
        ],
        "max_tokens": 1000,
        "key": "YOUR_API_KEY"
    }

try:
    response = requests.post(url, headers=headers, json=data)
    response.raise_for_status()  # Raises an HTTPError for bad responses (4XX or 5XX)
    result = response.json()
    print("API Response:")
    print(json.dumps(result, indent=2))
except requests.exceptions.HTTPError as http_err:
    print(f"HTTP error occurred: {http_err} - {response.text}")
except Exception as err:
    print(f"Other error occurred: {err}")</code>
```

View the [full API documentation](https://modelslab.com/models/microsoft/microsoft-phi-4-mini-instruct/api) for SDKs, code examples in Python, JavaScript, and more.

### Pricing

Microsoft: Phi 4 Mini Instruct API costs $0.215000 per million tokens. Pay only for what you use with no minimum commitments. [View pricing plans](https://modelslab.com/pricing)

### Use Cases

- AI chatbots and virtual assistants
- Code generation and developer tools
- Content writing and copywriting automation
- Data analysis, summarization, and extraction

[Browse LLM Models](https://modelslab.com/models?feature=llmaster) [More from Microsoft](https://modelslab.com/models/open_router) [View Pricing](https://modelslab.com/pricing)

Microsoft: Phi 4 Mini Instruct FAQ
---

### What is Microsoft: Phi 4 Mini Instruct?

Phi-4-mini-instruct is a lightweight open model built upon synthetic data and filtered publicly available websites - with a focus on high-quality, reasoning dense data. The model belongs to the Phi-4...

### How do I use the Microsoft: Phi 4 Mini Instruct API?

You can integrate Microsoft: Phi 4 Mini Instruct into your application with a single API call. Sign up on ModelsLab to get your API key, then use the model ID "microsoft-phi-4-mini-instruct" in your API requests. We provide SDKs for Python, JavaScript, and cURL examples in the API documentation.

### How much does Microsoft: Phi 4 Mini Instruct cost?

Microsoft: Phi 4 Mini Instruct costs $0.215000 per million tokens. ModelsLab uses pay-per-use pricing with no minimum commitments. A free tier is available to get started.

### What is the Microsoft: Phi 4 Mini Instruct model ID?

The model ID for Microsoft: Phi 4 Mini Instruct is "microsoft-phi-4-mini-instruct". Use this ID in your API requests to specify this model.

### Does Microsoft: Phi 4 Mini Instruct have a free tier?

Yes, ModelsLab offers a free tier that lets you try Microsoft: Phi 4 Mini Instruct and other AI models. Sign up to get free API credits and start building immediately.

---

*This markdown version is optimized for AI agents and LLMs.*

**Links:**
- [Website](https://modelslab.com)
- [API Documentation](https://docs.modelslab.com)
- [Blog](https://modelslab.com/blog)

---
*Generated by ModelsLab - 2026-05-06*