---
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-frontend-v2-927501783998.us-east4.run.app/models/microsoft/microsoft-phi-4-mini-instruct/api.md
canonical: https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/microsoft/microsoft-phi-4-mini-instruct/api.md
type: product
component: Playground/LLM/Index
generated_at: 2026-05-13T10:33:52.910440Z
---

Microsoft: Phi 4 Mini Instruct
---

 [LLMs.txt](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/microsoft-phi-4-mini-instruct/llms.txt) [.md](https://modelslab-frontend-v2-927501783998.us-east4.run.app/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-frontend-v2-927501783998.us-east4.run.app/models?feature=llmaster)

[DD](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/deepseek-deepseek-v3.2)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [DeepSeek: DeepSeek V3.2

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/deepseek-deepseek-v3.2)

[PS](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/perplexity-sonar-deep-research)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [Perplexity: Sonar Deep Research

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/perplexity-sonar-deep-research)

[OO](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/openai-o4-mini-high)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [OpenAI: o4 Mini High

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/openai-o4-mini-high)

[OG](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/openai-gpt-4-turbo-preview)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [OpenAI: GPT-4 Turbo Preview

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/openai-gpt-4-turbo-preview)

[AC](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/anthropic-claude-opus-4.7)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [Anthropic: Claude Opus 4.7

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/anthropic-claude-opus-4.7)

[![Gemini 2.5 Flash Image Preview ](https://images.stablediffusionapi.com/?Image=https://assets.modelslab.ai/generations/97c6f065-57f9-45b0-a190-08e5f97f70a8.png)](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/google/gemini-2.5-flash-image-preview)[Google](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/google)

 [Gemini 2.5 Flash Image Preview

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/google/gemini-2.5-flash-image-preview)

[Q4](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/Qwen-Qwen3-4B-Base)[Together AI](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai)

 [Qwen3 4B Base

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/Qwen-Qwen3-4B-Base)

[XM](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/xiaomi-mimo-v2.5)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [Xiaomi: MiMo-V2.5

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/xiaomi-mimo-v2.5)

[G5](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/zai-org-GLM-5.1)[Together AI](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai)

 [GLM 5.1 FP4

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/zai-org-GLM-5.1)

[QN](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/Qwen-Qwen3-Next-80B-A3B-Thinking)[Together AI](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai)

 [Qwen3 Next 80B A3b Thinking

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/Qwen-Qwen3-Next-80B-A3B-Thinking)

[PL](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/poolside-laguna-m.1-free)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [Poolside: Laguna M.1 (free)

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/poolside-laguna-m.1-free)

[ZG](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/z-ai-glm-4.7-flash)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [Z.ai: GLM 4.7 Flash

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/z-ai-glm-4.7-flash)

[QQ](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/Qwen-QwQ-32B)[Together AI](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai)

 [Qwen QwQ-32B

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/Qwen-QwQ-32B)

[AC](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/anthropic-claude-sonnet-4.6)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [Anthropic: Claude Sonnet 4.6

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/anthropic-claude-sonnet-4.6)

[OG](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/openai-gpt-oss-120b)[Together AI](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai)

 [OpenAI GPT-OSS 120B

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/openai-gpt-oss-120b)

[OG](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/openai-gpt-5.4-mini)[Open Router](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router)

 [OpenAI: GPT-5.4 Mini

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router/openai-gpt-5.4-mini)

[L3](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/nvidia-Llama-3.1-Nemotron-70B-Instruct-HF)[Together AI](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai)

 [Llama 3.1 Nemotron 70B Instruct HF

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/nvidia-Llama-3.1-Nemotron-70B-Instruct-HF)

[G3](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/google-gemma-3n-E4B-it)[Together AI](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai)

 [Gemma 3N E4B Instruct

Closed Source Model](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/together_ai/google-gemma-3n-E4B-it)

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-frontend-v2-927501783998.us-east4.run.app/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-frontend-v2-927501783998.us-east4.run.app/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-frontend-v2-927501783998.us-east4.run.app/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-frontend-v2-927501783998.us-east4.run.app/models?feature=llmaster) [More from Microsoft](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models/open_router) [View Pricing](https://modelslab-frontend-v2-927501783998.us-east4.run.app/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-13*