phi-4

Live
Microsoft

Phi-4 is a model built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&A datasets. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning.

Modality

Chat

Context window

16K tokens

Max output

16K tokens

Region

US

Published

Jul 21, 2026

Pricing

Input

3.93

EGP per 1M tokens

Output

7.87

EGP per 1M tokens

Use it via the API

phi-4 works with any OpenAI-compatible SDK — point the base URL at https://preprod-backend.sovereigneg.com/v1 and use your SovereignEG API key.

Run inference

OpenAI-compatible — POST /v1/chat/completions — drop-in for any OpenAI SDK.

from openai import OpenAI

client = OpenAI(
    base_url="https://preprod-backend.sovereigneg.com/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="phi-4",
    messages=[
        {"role": "user", "content": "What are some fun things to do in Cairo?"}
    ],
)

print(response.choices[0].message.content)

Frequently asked questions

How much does phi-4 cost?

3.93 EGP per 1M input tokens; 7.87 EGP per 1M output tokens. Billing is metered per token in Egyptian pounds (EGP), with no minimum commitment.

What is the context window of phi-4?

phi-4 supports a context window of 16,384 tokens (16K), with up to 16,384 output tokens per response.

Where is phi-4 hosted?

phi-4 is served from US (US-hosted inference).

How do I use phi-4 via the API?

phi-4 is available through the OpenAI-compatible SovereignEG API: point your SDK's base URL at https://preprod-backend.sovereigneg.com/v1 and call /v1/chat/completions with model "phi-4" and your API key.