MI

Phi 4

MicrosoftReleased Jan 9, 2025microsoft/phi-4
CostCompare

Phi-4 is a small, capable model trained on synthetic data, filtered public-domain web data and academic Q&A, focused on advanced reasoning.

Context
16K
Max output
8K
Input /1M
$0.07
Output /1M
$0.14
Blended /1M
$0.09
AcceptsTextProducesTextTokenizer Other

Providers

FastRouter routes your requests to this provider. You can also bring your own key.

Pricing tier
DeepInfra logo
DeepInfrabfloat16
deepinfra
Input /1M$0.07
Output /1M$0.14
Context16K
Max output8K
Latency—
Throughput—
Supports structured (JSON) output

Supported parameters

Request parameters you can send with this model.

Core (Sampling & basic generation)

max_tokens
Maximum tokens to generate.
min_p
Minimum probability threshold for sampling.
seed
Seed for deterministic sampling.
stop
Sequences where generation stops.
temperature
Controls randomness of output.
top_k
Limits sampling to top K tokens.
top_p
Nucleus sampling threshold.

Penalties (Token Penalties)

frequency_penalty
Penalizes frequent tokens.
presence_penalty
Penalizes tokens already present.
repetition_penalty
Penalizes repeated tokens.

Output & Format (Response Formatting)

logprobs
Return log probabilities of output tokens.
response_format
Structured output format configuration.
structured_outputs
Enforce a structured output schema.
top_logprobs
Number of top log probabilities to return.

Performance

Median throughput and time to first token per provider over the last week.

Throughput

Latency

Make your first API call

OpenAI-compatible. Point your SDK at FastRouter, or call the API directly.

Full API docs
Replace <FASTROUTER_API_KEY> with your key · Get your key →Install
OpenAI SDKHTTP
from openai import OpenAI
client = OpenAI(
base_url="https://api.fastrouter.ai/api/v1", # FastRouter base URL
api_key= "<FASTROUTER_API_KEY>", # Replace with your FastRouter API key
)
completion = client.chat.completions.create(
model="microsoft/phi-4", # Replace with your model ID
messages=[
{ "role": "user", "content": "What is the meaning of life?" }
]
)
print(completion.choices[0].message.content)

Frequently asked questions

Model scores sourced from ArtificialAnalysis