- Context Window
- 16K
- In
- $0.078per million tokens
- Out
- $0.156per million tokens
Microsoft
microsoft/ phi-4Specifications
In$0.078
Out$0.156
- Context Window
- 16K
- Modalities
- text
- Price
- $0.078 in · $0.156 out, per million tokens
- Model ID
- microsoft/phi-4
Quick start
microsoft/phi-4
$0.078 in · $0.156 out, per million tokens
import OpenAI from 'openai'
const client = new OpenAI({
apiKey: process.env.HANZO_API_KEY,
baseURL: 'https://api.hanzo.ai/v1'
})
const response = await client.chat.completions.create({
model: 'microsoft/phi-4',
messages: [{ role: 'user', content: 'Hello!' }]
})
console.log(response.choices[0].message.content)
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 https://api.hanzo.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $HANZO_API_KEY" \
-d '{
"model": "microsoft/phi-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'
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
View all Microsoft models →$1.09Bill a month
$1.09 a month at 10M in and 2M out.
Phi 4$1.0916K
- MAI-Voice-2 MAI-Voice-2 is an expressive text-to-speech model from Microsoft AI. It is suited for conversational assistants, media narration, accessibility, education, and other long-form voice applications. It supports 15 languages across 18...
- MAI-Voice-2-Flash MAI-Voice-2-Flash is a low-latency text-to-speech model from Microsoft AI for voice agents, assistants, call centers, accessibility, narration, and other interactive applications. It generates expressive 24 kHz mono speech across 15...
- MAI-Voice-2.1 MAI-Voice-2.1 is Microsoft AI's highest-fidelity, most expressive text-to-speech model. It produces natural, studio-grade speech across 23 languages, with detailed prosody, nuanced expressiveness, and speaker consistency over long-form content. It is...
- MAI-Voice-2.1-Flash MAI-Voice-2.1-Flash is a low-latency text-to-speech model from Microsoft AI, optimized for real-time responsiveness. It produces natural, expressive speech across 23 languages, with human-like intonation, rhythm, and emotional nuance. It is...
Use Phi 4 via Hanzo AI
One API key. Every major model. OpenAI-compatible. Start free.
