# Microsoft: Phi 4 — Use via Hanzo AI API

> Microsoft Research Phi-4 is designed to perform well in complex reasoning tasks and can operate efficiently in situations with limited memor... Access via Hanzo&#x27;s OpenAI-compatible API. Context: 16K. Get started free.

[Models](https://hanzo.ai/models)/[Microsoft](https://hanzo.ai/models/microsoft)/phi-4

# Microsoft: Phi 4

[Microsoft](https://hanzo.ai/models/microsoft)

Microsoft Research Phi-4 is designed to perform well in complex reasoning tasks and can operate efficiently in situations with limited memory or where quick responses are needed. At 14 billion...

text

[Get API Key](https://hanzo.ai/signup)[View Docs](https://docs.hanzo.ai)[Try in Chat](https://hanzo.ai/chat)

## Specifications

Context Window

16K

Modalities

text

Input

$0.084 / M tokens

Output

$0.168 / M tokens

Status

available

Category

third-party

Model ID

microsoft/phi-4

## Quick Start

TypeScript

```
import OpenAI from &#x27;openai&#x27; const client = new OpenAI({ apiKey: process.env.HANZO_API_KEY, baseURL: &#x27;https://api.hanzo.ai/v1&#x27; }) const response = await client.chat.completions.create({ model: &#x27;microsoft/phi-4&#x27;, messages: [{ role: &#x27;user&#x27;, content: &#x27;Hello!&#x27; }] }) console.log(response.choices[0].message.content)
```

Python

```
from openai import OpenAI client = OpenAI( api_key=os.environ["HANZO_API_KEY"], base_url="https://api.hanzo.ai/v1" ) response = client.chat.completions.create( model="microsoft/phi-4", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content)
```

cURL

```
curl https://api.hanzo.ai/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $HANZO_API_KEY" \ -d &#x27;{ "model": "microsoft/phi-4", "messages": [{"role": "user", "content": "Hello!"}] }&#x27;
```

Go

```
package main import ( "context" "fmt" "os" "github.com/sashabaranov/go-openai" ) func main() { cfg := openai.DefaultConfig(os.Getenv("HANZO_API_KEY")) cfg.BaseURL = "https://api.hanzo.ai/v1" client := openai.NewClientWithConfig(cfg) resp, _ := client.CreateChatCompletion(context.Background(), openai.ChatCompletionRequest{ Model: "microsoft/phi-4", Messages: []openai.ChatCompletionMessage{ {Role: openai.ChatMessageRoleUser, Content: "Hello!"}, }, }, ) fmt.Println(resp.Choices[0].Message.Content) }
```

## More from Microsoft

[WizardLM-2 8x22B66KWizardLM-2 8x22B is Microsoft AI&#x27;s most advanced Wizard model. It demonstrates highly competitive performance compared to leading proprietary models, and it consistently outperforms all existing state-of-the-art opensource models. It is...](https://hanzo.ai/models/microsoft/wizardlm-2-8x22b)

[View all Microsoft models →](https://hanzo.ai/models/microsoft)

## Use Microsoft: Phi 4 via Hanzo AI

One API key. Every major model. OpenAI-compatible. Start free.

[Get Free API Key](https://hanzo.ai/signup)[Browse All Models](https://hanzo.ai/models)
