// Reka as a Pi model provider: `pi --model reka/glm5.3-flash`, or pick a Reka model with /model. // // One file, nothing to install beyond Pi itself: save it as ~/.pi/agent/extensions/reka.ts, where // Pi loads it at startup. // curl -fsSL --create-dirs -o ~/.pi/agent/extensions/reka.ts https://developer.reka.ai/install/pi/reka.ts // Running the same command again updates it; deleting the file removes Reka. // // It registers Reka the way Pi documents for an OpenAI-compatible endpoint: a provider name and // its models, with Pi's own OpenAI Chat Completions client making the requests. The only import // is a type, which disappears at runtime. // - The key comes from REKA_API_KEY, or from /login, which saves it in Pi's auth.json. // REKA_BASE_URL optionally points at another endpoint, with or without its /v1. // - Each model maps Pi's thinking levels onto Reka's top-level `reasoning_effort` one to one, so // `off` sends `none` (thinking off) instead of leaving the field out, which would let a model // think by default. Which levels a model accepts is up to the model. // - The list is fixed per release: a model is added once it answers a live chat and makes a // tool call on Reka's API. // // Built from models.json, which is served next to this file: // https://developer.reka.ai/install/pi/models.json import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; const REKA = { "name": "Reka", "baseUrl": "https://api.reka.ai/v1", "api": "openai-completions", "apiKey": "$REKA_API_KEY", "compat": { "supportsStore": false, "supportsDeveloperRole": false, "supportsReasoningEffort": true, "thinkingFormat": "openai", "maxTokensField": "max_tokens", "supportsLongCacheRetention": false }, "models": [ { "id": "qwen3.8-27b", "name": "Qwen3.8 27B", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 262144, "maxTokens": 32768, "cost": { "input": 0.2, "output": 2.5, "cacheRead": 0.05, "cacheWrite": 0 }, "thinkingLevelMap": { "off": "none", "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max" } }, { "id": "glm5.3-flash", "name": "GLM 5.3 Flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1048576, "maxTokens": 32768, "cost": { "input": 0.15, "output": 0.5, "cacheRead": 0.015, "cacheWrite": 0 }, "thinkingLevelMap": { "off": "none", "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max" } }, { "id": "deepseek41-flash", "name": "DeepSeek V4.1 Flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1048576, "maxTokens": 32768, "cost": { "input": 0.3, "output": 1.2, "cacheRead": 0.006, "cacheWrite": 0 }, "thinkingLevelMap": { "off": "none", "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max" } }, { "id": "qwen3.6-27b", "name": "Qwen3.6 27B", "reasoning": true, "input": [ "text" ], "contextWindow": 262144, "maxTokens": 32768, "cost": { "input": 0.29, "output": 1.95, "cacheRead": 0.029, "cacheWrite": 0 }, "thinkingLevelMap": { "off": "none", "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max" } }, { "id": "deepseek41-flash-20261017", "name": "DeepSeek V4.1 Flash 1017", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1048576, "maxTokens": 32768, "cost": { "input": 0.15, "output": 0.6, "cacheRead": 0.003, "cacheWrite": 0 }, "thinkingLevelMap": { "off": "none", "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max" } }, { "id": "glm5.3", "name": "GLM 5.3", "reasoning": true, "input": [ "text" ], "contextWindow": 1048576, "maxTokens": 32768, "cost": { "input": 1.17, "output": 3.96, "cacheRead": 0.234, "cacheWrite": 0 }, "thinkingLevelMap": { "off": "none", "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max" } }, { "id": "ergo", "name": "Amazon Ergo", "reasoning": true, "input": [ "text" ], "contextWindow": 1048576, "maxTokens": 32768, "cost": { "input": 1, "output": 3, "cacheRead": 0.1, "cacheWrite": 0 }, "thinkingLevelMap": { "off": "none", "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max" } }, { "id": "kimi-k3.1-pro", "name": "Kimi K3.1 Pro", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1048576, "maxTokens": 32768, "cost": { "input": 2, "output": 10, "cacheRead": 0.2, "cacheWrite": 0 }, "thinkingLevelMap": { "off": "none", "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh", "max": "max" } } ] }; export default function (pi: ExtensionAPI) { // Pi's client adds /chat/completions to the base, so the base ends in /v1. Other Reka tools, // such as the Reka CLI, set REKA_BASE_URL without it. const base = (process.env.REKA_BASE_URL || REKA.baseUrl).replace(/\/+$/, ""); pi.registerProvider("reka", { name: REKA.name, baseUrl: base.endsWith("/v1") ? base : `${base}/v1`, apiKey: REKA.apiKey, api: REKA.api, models: REKA.models.map((model) => ({ ...model, input: model.input as ("text" | "image")[], compat: REKA.compat, })), }); }