Coding agent

Pi

Pi, pointed at Europe.

A few lines of TypeScript register Melious as a custom provider. Hot-reloadable, code-first, no JSON config to maintain.

~/.pi/agent/extensions/melious.ts
import type { ExtensionAPI } from class="s">"@mariozechner/pi-coding-agent";

export default function (pi: ExtensionAPI) {
  pi.registerProvider(class="s">"melious", {
    name: class="s">"Melious",
    baseUrl: class="s">"https:class="cclass="s">">//api.melious.ai/v1",
    apiKey: class="s">"MELIOUS_API_KEY",
    api: class="s">"openai-completions",
    models: [
      {
        id: class="s">"<MODEL_ID>",
        name: class="s">"<Display Name>",
        reasoning: false,
        input: [class="s">"text"],
        cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
        contextWindow: 128000,
        maxTokens: 4096
      }
    ]
  });
}
About

What is Pi?

Pi is a minimal MIT-licensed terminal coding harness. It speaks several providers out of the box and lets you wire in custom ones through TypeScript extensions rather than config files. Sessions are tree-structured. The agent surface is built around primitives (extensions, skills, prompt templates, AGENTS.md context), and /model swaps the active model at any point. Pointing it at Melious is a single extension file dropped in ~/.pi/agent/extensions/.

Visit the official site pi.dev
Setup

How to use Pi with Melious?

  1. Install Pi

    Pi ships as an npm package. After install, pi is on your PATH and ready for first launch.

    Shell
    npm install -g @mariozechner/pi-coding-agent
  2. Register Melious as a provider

    Drop a TypeScript extension into ~/.pi/agent/extensions/ (or .pi/extensions/ per project). Pi auto-discovers it on launch and supports /reload for hot-edits. Use the async factory below to fetch our live model catalog and register every chat model in one go, no manual updates when the catalog changes.

    ~/.pi/agent/extensions/melious.ts
    import type { ExtensionAPI } from class="s">"@mariozechner/pi-coding-agent";
    
    export default async function (pi: ExtensionAPI) {
      const apiKey = process.env.MELIOUS_API_KEY;
      if (!apiKey) return;
    
      const res = await fetch(class="s">"https:class="cclass="s">">//api.melious.ai/v1/models?include_meta=true", {
        headers: { Authorization: class="s">`Bearer ${apiKey}` },
      });
      const { data } = await res.json();
    
      pi.registerProvider(class="s">"melious", {
        name: class="s">"Melious",
        baseUrl: class="s">"https:class="cclass="s">">//api.melious.ai/v1",
        apiKey: class="s">"MELIOUS_API_KEY",
        api: class="s">"openai-completions",
        models: data
          .filter((m: any) => m._meta?.type === class="s">"chat")
          .map((m: any) => ({
            id: m.id,
            name: m._meta?.display_name ?? m.id,
            reasoning: m._meta?.capabilities?.reasoning ?? false,
            input: m._meta?.capabilities?.vision ? [class="s">"text", class="s">"image"] : [class="s">"text"],
            cost: {
              input: m._meta?.pricing?.input_per_1m ?? 0,
              output: m._meta?.pricing?.output_per_1m ?? 0,
              cacheRead: 0,
              cacheWrite: 0,
            },
            contextWindow: m._meta?.context_length ?? 128000,
            maxTokens: m._meta?.max_output_tokens ?? 4096,
          })),
      });
    }
  3. Run Pi

    Export your key, then launch. /model switches the active model mid-session. pi --list-models confirms what got registered, pi --provider melious filters to ours.

    Shell
    export MELIOUS_API_KEY=sk-mel-<YOUR_API_KEY>
    pi
Ready?

Three steps from here.

Grab a Melious key. Pick your tool. Follow the guide. Same client, now answering from Europe.