Microsoft: phi-4
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 parameters, it was trained on a mix of high-quality synthetic datasets, data from curated websites, and academic materials. It has undergone careful improvement to follow instructions accurately and maintain strong safety standards. It works best with English language inputs.
For more information, please see Phi-4 Technical Report.
Pricing
Current price per 1,000,000 tokens. Every request is billed automatically from its exact usage.
Statistics
Live performance and usage of this model, aggregated across all users.
API
Call this model from any OpenAI-compatible client using your API token.
https://apiex.cloud/api/v1/chat/completions
<?php
$ch = curl_init( "https://apiex.cloud/api/v1/chat/completions" );
curl_setopt_array( $ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json",
),
CURLOPT_POSTFIELDS => json_encode( array(
"model" => "microsoft/phi-4",
"messages" => array(
array(
"role" => "user",
"content" => "Explain quantum entanglement in one paragraph.",
),
),
"temperature" => 0.7,
) ),
) );
$response = json_decode( curl_exec( $ch ), true );
print_r( $response );
Authentication
Every request must include an Authorization: Bearer <TOKEN> header. Generate a token from your account's API Keys page — you can set its rate limit and IP restrictions.
Supported parameters
| Parameter | Type | Description |
|---|---|---|
model |
string, required | This model's ID, exactly as shown above. |
messages |
array, required | Conversation history as role/content objects (system, user, assistant). |
temperature |
number, optional | Sampling randomness, typically 0–2. |
max_tokens |
integer, optional | Upper limit on tokens generated in the reply. |
top_p |
number, optional | Nucleus-sampling threshold, as an alternative to temperature. |
stream |
boolean, ignored | Responses are always returned in full so the exact cost can be billed; streaming is not available. |
Frequently asked questions
What is phi-4?
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 parameters, it was trained on a mix of high-quality synthetic datasets, data from curated websites, and academic materials. It has undergone careful improvement to follow instructions accurately and maintain strong safety standards. It works best with English language inputs.
For more information, please see Phi-4 Technical Report.
How much does phi-4 cost?
Input tokens are priced at $0,084 per 1,000,000 tokens and output tokens at $0,168 per 1,000,000 tokens. Pricing is billed automatically per request; no separate plan is required.
What is the context length of phi-4?
phi-4 supports a context window of up to 16,384 tokens.
Does phi-4 support image input?
phi-4 currently accepts text input only.
Which provider is phi-4 from?
phi-4 is developed by Microsoft and made available on this gateway through our routing infrastructure.
When was phi-4 added to this gateway?
phi-4 has been available on this gateway since September 23, 2026.
Is phi-4 currently available?
Yes, phi-4 is active and can be used right now through this gateway.
Explore more models
Keep exploring
Ready to build with one API?
Create an account, make a key and send your first request in a few minutes.