Skip to main content
Phi-4 is Microsoft’s small-model family: dense models trained on curated, reasoning-heavy synthetic data so they punch above their parameter count on math and logic. The lineup spans a 14B desktop model, a 3.8B mini model light enough for a laptop or edge box, and a 5.6B multimodal model that adds image and audio input. Run whichever fits your hardware locally, then pair the Tokios connector to call it from any machine, teammate, or hosted agent through https://api.tokios.com — no inbound ports, no VPN.

Run it locally with Ollama

Phi-4 (14B) is in the Ollama library. Pull and run it:
For the smaller mini model, run ollama run phi4-mini. See the Ollama library page for the full tag list — this page covers connecting it, not every runtime detail.
Ollama’s default context window is small (2048 tokens) — well below what Phi-4 supports natively. Raise num_ctx in your Modelfile or client request to use more context, especially on the mini model’s 128K window.

Variants & tags

Every value below is from the model cards on Hugging Face and the Ollama library. Tags and download sizes change as new quantizations ship — confirm against ollama.com/library/phi4 and ollama.com/library/phi4-mini before you standardize on one. Sources: ollama.com/library/phi4, ollama.com/library/phi4-mini, microsoft/phi-4 model card, microsoft/Phi-4-mini-instruct model card, microsoft/Phi-4-multimodal-instruct model card.
There are also phi4-reasoning (14B, <think>-style chain-of-thought, 32K context) and phi4-mini-reasoning (3.8B, 128K context) tags in the Ollama library, fine-tuned from the base models for explicit reasoning traces. They’re separate pulls (ollama run phi4-reasoning), not a flag on the base models — see ollama.com/library/phi4-reasoning if you want the reasoning-tuned variant instead of the instruct one covered on this page.

Quantization & formats

Ollama’s default tags are GGUF Q4_K_M. The library also publishes -q8_0 and -fp16 for both phi4 and phi4-mini. Which format you can run depends on your hardware — see Quantization formats and the hardware they need for the full matrix, and what quantization is for how to read the Q4_K_M-style names.

Hardware fit

Comfort at roughly Q4 for a modest context length. Treat every entry as an estimate — the ground truth is the actual GGUF size plus the KV cache for your context. See what size model fits your GPU? for the sizing math.

Run it — beginner to advanced

Leave Ollama listening on the default http://127.0.0.1:11434. Raise num_ctx to use more context, and swap in phi4-mini for a lighter footprint.

Capabilities

  • Reasoning: The instruct models covered here answer directly — no <think> block. Microsoft ships separate phi4-reasoning and phi4-mini-reasoning checkpoints (see the tip above) that emit explicit <think>…</think> chain-of-thought for math-heavy tasks; pull those instead if you want that behavior.
  • Tool-calling: Phi-4 (14B) has no tool role in its chat template — don’t rely on structured function calls from it. Phi-4-mini and Phi-4-multimodal support it: wrap your tool definitions in <|tool|>...<|/tool|> inside the system message, per their model cards.
  • Vision and audio: Only Phi-4-multimodal. It accepts text, image, and audio in the same prompt (<|image_1|>, <|audio_1|> placeholders) and is not available as an Ollama tag — run it via Transformers or vLLM.
  • Long context: Phi-4 (14B) is limited to 16,384 tokens. Phi-4-mini and Phi-4-multimodal both support 131,072 tokens.

Connect it with Tokios

Once Phi-4 is running locally, pair the Tokios connector so you can reach it as https://api.tokios.com from Claude Code, Cline, or any other compatible client — instead of only from localhost:11434.
1

Pair the Tokios connector

Sign in at tokios.com/console, open the Setup tab, and click Start pairing to get a one-time claim code (TKS-XXXX-XXXX). Install and run the connector on the machine running Ollama:
Windows
macOS
Linux
Then approve the device on the Setup or Connectors tab.
2

Point the connector at Ollama's /v1 API

Ollama exposes an OpenAI-compatible surface at /v1. For a single-model setup, the console’s Setup wizard fills this in automatically as http://127.0.0.1:11434/v1. For multiple models, set it explicitly in tokios-connector.json — see Connector config.
3

Register a deployment

In the Models tab, register the model and choose a public deployment name, for example phi-tunnel. This name — not Ollama’s local model id — is what clients send in the model field.
4

Create an API key

In the Keys tab, click Create key. Copy the sk-tok-… key now — it’s shown only once.

Call it from anywhere

The model field is always your registered deployment name (phi-tunnel above), never Ollama’s local model id. See Use Claude Code and Use Cline for full client setup.

Caveats

  • Phi-4 (14B) tops out at a 16,384-token context window — much shorter than most current open models. If you need long context on a Phi model, use phi4-mini (131,072 tokens) instead.
  • Phi-4 (14B) has no tool-calling support in its chat template. Reach for phi4-mini if your workflow needs function calls.
  • Phi-4-multimodal isn’t on Ollama — you’ll need Transformers or vLLM (with trust_remote_code) to serve its vision/audio capabilities locally.
  • Reasoning-tuned variants (phi4-reasoning, phi4-mini-reasoning) are separate model pulls, not a mode switch on the instruct models covered here.

Quickstart

Pair a connector and register your first model end to end.

What size model fits your GPU?

Match Phi-4 to your available VRAM before you pull it.

Quantization & hardware

Which of Phi-4’s GGUF formats runs on your hardware.

Which local model for which task?

See how Phi-4 compares to other local models by task.