Microsoft Phi 4 Mini 3.8B on W&B Inference
Price per 1M tokens
$0.08 (input)
$0.35 (output)
Parameters
3.8B
Context window
128K
Release date
Feb 2025
Microsoft Phi 4 Mini 3.8B inference details
Phi 4 Mini is optimized for use in lightweight environments, excelling at quick interactions, and constrained-resource deployments. It supports strong mathematical and logical inference, suitable for embedded applications, mobile environments, or real-time AI assistants.
Created by: Microsoft
License: mit
🤗 model card: Phi-4-mini-instruct
import openai
import weave
# Weave autopatches OpenAI to log LLM calls to W&B
weave.init("/")
client = openai.OpenAI(
# The custom base URL points to W&B Inference
base_url='https://api.inference.wandb.ai/v1',
# Get your API key from https://wandb.ai/authorize
# Consider setting it in the environment as OPENAI_API_KEY instead for safety
api_key="",
# Team and project are required for usage tracking
project="/",
)
response = client.chat.completions.create(
model="microsoft/Phi-4-mini-instruct",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me a joke."}
],
)
print(response.choices[0].message.content)