---
title: "Best Models for Pi Coding Agent (2026): Pick by Task"
description: "Choose a Pi model for everyday coding, hard debugging, budget work, or local use. Current model IDs, thinking settings, and Haimaker configuration included."
date: 2026-10-14
location: San Francisco, CA – October 14, 2026
image: /images/best-models-for-pi-coding-agent-hero.jpg
keywords: "best models for pi coding agent, best model for pi agent, pi coding agent models, pi.dev models, pi agent claude, pi agent openai, pi agent local models, pi haimaker"
models:
  - provider: anthropic
    slug: claude-sonnet-5-5
    name: Claude Sonnet 5.5
    note: Starting point for everyday coding.
  - provider: openai
    slug: gpt-6.1-sol
    name: GPT-6.1 Sol
    note: OpenAI option for coding and agent work.
  - provider: anthropic
    slug: claude-opus-5-5
    name: Claude Opus 5.5
    note: Candidate for difficult debugging and ambiguous tasks.
  - provider: minimax
    slug: minimax-m3
    name: MiniMax M3
    note: Budget candidate for routine agent work.
  - provider: deepseek
    slug: deepseek-v4.1-flash
    name: DeepSeek V4.1 Flash
    note: Compare retries and elapsed time as well as token rates.
faq:
  - question: "Can I change models without losing my Pi session?"
    answer: "Yes. Use /model to change the model in an existing Pi session. Pi records model and thinking-level changes, and resuming restores them. Use /scoped-models to choose the models available for cycling with Ctrl+P."
  - question: "Why does my custom model not appear in Pi?"
    answer: "Check that Pi can resolve the provider credentials and that the model ID is in models.json. An environment variable must be present in the process that starts Pi. Classifier and image models use separate tools and do not appear in the main /model picker."
  - question: "Does Pi support Haimaker and local Ollama models?"
    answer: "Yes. Use npx -y @haimaker/connect --pi to configure Haimaker through Pi's native files, or add the provider manually in ~/.pi/agent/models.json. Ollama uses a separate local provider at http://localhost:11434/v1 with the exact local model tag."
---

The best models for Pi Coding Agent depend on the job: start with **Claude Sonnet 5.5** for everyday coding or **GPT-6.1 Sol** for an OpenAI option. Try **Claude Opus 5.5** on difficult debugging, compare **MiniMax M3** and **DeepSeek V4.1 Flash** for routine work, and test **Qwen3.8 27B** when code must stay on your machine.

[Pi](https://pi.dev/) is an extensible agent harness that runs in your terminal. The harness manages the conversation and tools; the model decides which files to read, which commands to run, and what to change. Pi lets you switch models inside that workflow, so you can compare them on the same repository rather than choosing from unrelated leaderboards.

Model IDs and availability were checked against the [Haimaker catalog](https://api.haimaker.ai/public/model_hub) on **October 14, 2026**. The recommendations combine current provider information with a small, independent Pi evaluation. We have not run a new Haimaker benchmark of these models in Pi.

## Which model should you start with in Pi?

Start with Sonnet 5.5 or GPT-6.1 Sol on a task you already know how to verify. Keep the tool access and repository state fixed, then compare a budget candidate on the same task. Move to Opus when the cheaper model repeats a failed approach or needs too much human correction.

| Pi workload | Model to try | Haimaker model ID | Tradeoff |
|---|---|---|---|
| Everyday edits, tests, and repository work | Claude Sonnet 5.5 | `anthropic/claude-sonnet-5-5` | Costs more per token than budget choices |
| Coding and planning with an OpenAI model | GPT-6.1 Sol | `openai/gpt-6.1-sol` | Compare reasoning effort and total tokens |
| Difficult debugging or unclear requirements | Claude Opus 5.5 | `anthropic/claude-opus-5-5` | Higher token rates; may need fewer attempts |
| Routine coding on a budget | MiniMax M3 | `minimax/minimax-m3` | Test tool arguments and failure recovery |
| Low-cost background tasks | DeepSeek V4.1 Flash | `deepseek/deepseek-v4.1-flash` | Retries and latency can outweigh low rates |
| Another budget comparison | GLM-5.3 Flash | `z-ai/glm-5.3-flash` | Check long outputs and total task time |
| Research and large document inputs | Gemini 3.8 Flash | `google/gemini-3.8-flash` | Large input capacity still needs answer verification |
| Difficult research and reasoning | Gemini 4 Argon | `google/gemini-4-argon` | New paid candidate, absent from the Pi evaluation below |

[Anthropic's model overview](https://platform.claude.com/docs/en/models/overview) describes the current Claude tiers. [OpenAI's Sol documentation](https://developers.openai.com/api/docs/models/gpt-6.1-sol) covers its coding and agent role, and [Google's model list](https://ai.google.dev/gemini-api/docs/models) covers the Gemini choices. Those descriptions help form a shortlist; they do not establish a winner on your codebase.

This is the same task-based approach used in our [Hermes model guide](/blog/best-models-for-hermes-agent/). Pi's configuration, model cycling, and thinking controls are different, so use the Pi setup below rather than copying a Hermes configuration.

## What do actual Pi coding comparisons show?

A small Pi evaluation supports testing Sonnet, Sol, and Opus before assuming a budget model will finish faster or cheaper. It also shows that more reasoning can add checking and tool calls without improving completion on an easy task. The useful comparison is the finished job, including failed attempts and review time.

Ibragim Badertdinov's [personal coding evaluation](https://ibragim.dev/leaderboard/) used **10 tasks with 3 runs per configuration**. The September 30 results report:

| Model and effort | Single-attempt task success | Reported time per task |
|---|---|---|
| Sonnet 5.5, high | 100% | 46 seconds |
| GPT-6.1 Sol, medium | 100% | 1 minute 7 seconds |
| Opus 5.5, low | 100% | 37 seconds |
| DeepSeek V4.1 Flash, max | 93.3% | 4 minutes 30 seconds |
| GLM-5.3 Flash, max | 96.7% | 7 minutes 1 second |

These are the author's results, not ours. The [methodology](https://ibragim.dev/writing/mini-benchmark-for-coding-agents/) describes clearly defined tasks from the author's work, automated checks, and API access. The tasks remain private, and the results used **Pi 0.85.1**, rather than the current Pi 1.x release. Equal pass rates also do not establish equal code quality.

The comparison gives a reason to test reasoning effort as well as the model. Opus at low effort completed this small suite faster than the other configurations shown. That does not mean low effort is enough for a difficult migration. Run the task with its real constraints, then inspect whether extra reasoning changes the patch or only adds repeated checks.

For your own comparison, record successful completion, incorrect tool arguments, retries, elapsed time, and the final bill. Our [coding-agent API cost guide](/blog/cheapest-api-coding-agents/) explains why token rates alone can give the wrong answer.

## How do you connect Pi to these models?

Use [Haimaker Connect](https://haimaker.ai/connect/) to connect Pi without writing the provider configuration by hand. Install Pi first, then run Connect to configure its native files and verify the connection.

For a new installation, Pi's [quickstart](https://pi.dev/docs/latest/quickstart) uses the current npm package below and requires **Node.js 22.19 or newer**:

```bash
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
pi --version
```

#### Recommended: Haimaker Connect

Run the setup wizard and choose Pi:

```bash
npx -y @haimaker/connect
```

For Pi with the Sonnet recommendation above, select both explicitly:

```bash
npx -y @haimaker/connect --pi --model anthropic/claude-sonnet-5-5
pi --provider haimaker --model anthropic/claude-sonnet-5-5
```

Connect opens a browser login or uses an existing `HAIMAKER_API_KEY`. It writes the Haimaker provider to `models.json`, stores the key in Pi's `auth.json`, and verifies one request. Pi then sends requests directly to Haimaker. See the [Connect package documentation](https://www.npmjs.com/package/@haimaker/connect) for options.

Without `--model`, Connect configures `haimaker/auto`. Use a named model for comparisons so routing does not change the model between requests. Connect writes a single model entry; use the manual configuration below to keep several candidates in Pi's picker. It backs up existing files, but rewrites `models.json` as JSON without comments.

<div class="post-cta">
  <p>Use Haimaker Connect to configure Pi, then compare models on the same repository task.</p>
  <a href="https://haimaker.ai/connect/?utm_source=blog&utm_medium=cta&utm_campaign=best-models-for-pi-coding-agent_mid" class="cta-button">CONNECT PI TO HAIMAKER</a>
</div>

#### Manual configuration: keep several models in the picker

Set your key in the shell that will start Pi:

```bash
export HAIMAKER_API_KEY=your-haimaker-key
```

Add this provider to `~/.pi/agent/models.json`. Merge it into an existing `providers` object if you already have one:

```json
{
  "$schema": "https://pi.dev/schemas/models.schema.json",
  "providers": {
    "haimaker": {
      "baseUrl": "https://api.haimaker.ai/v1",
      "api": "openai-completions",
      "apiKey": "${HAIMAKER_API_KEY}",
      "models": [
        {
          "id": "anthropic/claude-sonnet-5-5",
          "name": "Claude Sonnet 5.5",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 1000000,
          "maxTokens": 128000
        },
        {
          "id": "openai/gpt-6.1-sol",
          "name": "GPT-6.1 Sol",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 922000,
          "maxTokens": 128000
        },
        {
          "id": "minimax/minimax-m3",
          "name": "MiniMax M3",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 1000000,
          "maxTokens": 128000
        }
      ]
    }
  }
}
```

The limits above describe the checked Haimaker catalog, which can differ from a provider's direct API. Pi accepts environment interpolation in provider credentials; see its [model configuration guide](https://pi.dev/docs/latest/models). Start with a bounded task before sending a large repository context.

Select the model with both identifiers:

```bash
pi --provider haimaker --model anthropic/claude-sonnet-5-5
```

Inside Pi, open `/model` to select another configured model. The picker reloads `models.json`. Custom pricing metadata is omitted from this example because rates change; check the provider bill rather than treating an unconfigured session cost display as a measured zero-cost run.

#### A provider account you already have

For a built-in provider, run `/login` and follow Pi's authentication flow, then choose a model with `/model`. Pi's [provider reference](https://pi.dev/docs/latest/providers) lists API-key variables and provider-specific options. A subscription and a metered API key can have different access and billing, so use the connection method your account actually supports.

## How should you set thinking levels and switch models?

Keep model choice and thinking effort as separate variables. Use a moderate effort where supported for the first comparison, then increase it on a task that needs more reasoning. Pi restricts levels to the selected model's capabilities. Compare token use and completion when choosing effort; providers interpret the same level differently.

Pi's [CLI reference](https://pi.dev/docs/latest/cli) supports an explicit model and effort:

```bash
pi --provider haimaker --model openai/gpt-6.1-sol --thinking medium
```

In an interactive session, `/thinking` changes effort and `/scoped-models` chooses the models you cycle through with `Ctrl+P`. Start with **2 models** in that cycle: a routine-work candidate and a stronger alternative. Add another only when it solves a recurring failure. Save a startup default from the model picker with `Ctrl+S`.

Switching models manually keeps the choice visible. Haimaker's `haimaker/auto` routes on the API side. For routing within Pi, use [virtual model routing](https://pi.dev/docs/latest/virtual-models) through extensions. Configure and test that extension separately. Several entries in `models.json` give you selectable models; the list does not choose between them.

Pi also separates coding models from [classifier and image models](https://pi.dev/docs/latest/models#use-classifier-models). Its current documentation lists GPT-6 Luna through the Decisions API as a classifier used by Codemode, rather than the main conversation picker. Check the model's API and role when following a community recommendation, especially one made on an older Pi version.

## Which local models are worth trying with Pi?

Compare **Qwen3.8 27B**, **Muse Glimmer 30B**, and **Qwen3 Coder 30B** when you have workstation memory and want local inference. Use **Gemma 4 E4B** or **Qwen3 8B** on smaller machines. Check whether the local model uses Pi's tools correctly and recovers after a command fails.

Pi has a documented [llama.cpp router integration](https://pi.dev/docs/latest/llama-cpp) for GGUF models. If you already use Ollama, configure its separate OpenAI-compatible endpoint. Pull a model that fits the machine, then add its exact tag to `models.json`:

```bash
ollama pull qwen3.8:27b
```

```json
{
  "providers": {
    "ollama": {
      "baseUrl": "http://localhost:11434/v1",
      "api": "openai-completions",
      "apiKey": "ollama",
      "models": [
        {
          "id": "qwen3.8:27b",
          "name": "Qwen3.8 27B local",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 32768,
          "maxTokens": 8192
        }
      ]
    }
  }
}
```

The placeholder key lets Pi resolve authentication for the local provider; Ollama ignores it. Merge this provider alongside any cloud configuration, then select it:

```bash
pi --provider ollama --model qwen3.8:27b
```

[Qwen3.8's Ollama listing](https://ollama.com/library/qwen3.8) shows an approximately **18GB download**, before context state and runtime buffers. A 24GB GPU or 32GB+ unified-memory machine is a starting point for a bounded session. The 32K context in this example is a conservative starting setting, not a guarantee of fit. For smaller machines and other candidates, see our [Ollama coding-model guide](/blog/best-ollama-models-for-coding-agents/).

Local inference keeps the model's prompts on your machine. External tools can still send data elsewhere, and a model with a `cloud` tag uses hosted inference. Check both the endpoint and the enabled tools when keeping code private.

## Frequently asked questions

#### Can I change models without losing my Pi session?

Yes. Use /model to change the model in an existing Pi session. Pi records model and thinking-level changes, and resuming restores them. Use /scoped-models to choose the models available for cycling with Ctrl+P.

#### Why does my custom model not appear in Pi?

Check that Pi can resolve the provider credentials and that the model ID is in models.json. An environment variable must be present in the process that starts Pi. Classifier and image models use separate tools and do not appear in the main /model picker.

#### Does Pi support Haimaker and local Ollama models?

Yes. Use npx -y @haimaker/connect --pi to configure Haimaker through Pi's native files, or add the provider manually in ~/.pi/agent/models.json. Ollama uses a separate local provider at http://localhost:11434/v1 with the exact local model tag.

Start with one verified repository task, keep Pi's tools and context fixed, and compare two models. Keep the model that completes it correctly with less waiting and review work. Repeat that comparison when a new release addresses a failure you actually encounter.
