Phi 4
MicrosoftReleased Jan 10, 2025
[Microsoft Research](/microsoft) 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...
- Context window
- 16K tokens
- Max output
- 16K tokens
- Input
- text
- Output
- text
- Tokenizer
- Other
- Knowledge cutoff
- Jun 30, 2024
- Released
- Jan 10, 2025
Pricing
Per 1M tokens. The provider price and our flat 3% fee are separate columns — what you pay is their sum.
| Per 1M tokens | Provider | + 3% fee | You pay |
|---|---|---|---|
| Input | $0.070 | $0.0021 | $0.072 |
| Output | $0.140 | $0.0042 | $0.144 |
Supported parameters
- frequency_penalty
- logit_bias
- max_tokens
- min_p
- presence_penalty
- repetition_penalty
- response_format
- seed
- stop
- structured_outputs
- temperature
- top_k
- top_p
Call it
OpenAI-compatible: point your SDK at api.openkey.ai/v1 and use model microsoft/phi-4.
curl https://api.openkey.ai/v1/chat/completions \
-H "Authorization: Bearer $OPENKEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "microsoft/phi-4",
"messages": [{"role": "user", "content": "Hello"}]
}'import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.openkey.ai/v1",
api_key=os.environ["OPENKEY_API_KEY"],
)
completion = client.chat.completions.create(
model="microsoft/phi-4",
messages=[{"role": "user", "content": "Hello"}],
)
print(completion.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.openkey.ai/v1",
apiKey: process.env.OPENKEY_API_KEY,
});
const completion = await client.chat.completions.create({
model: "microsoft/phi-4",
messages: [{ role: "user", content: "Hello" }],
});
console.log(completion.choices[0].message.content);Questions
- How much does Phi 4 cost via API?
- Through OpenKey, Phi 4 costs $0.072 per 1M input tokens and $0.144 per 1M output tokens. That is the provider price ($0.070 / $0.140) plus a flat 3% fee — nothing else.
- What is Phi 4's context window?
- Phi 4 accepts up to 16K tokens of context and returns up to 16K tokens per request.
- Is Phi 4 OpenAI-compatible?
- Yes. Send requests to OpenKey's /v1/chat/completions endpoint with model "microsoft/phi-4" using any OpenAI SDK — only the base URL and API key change.
- What inputs does Phi 4 support?
- Phi 4 accepts text input and produces text output. Its knowledge cutoff is Jun 30, 2024.