Skip to content

Instantly share code, notes, and snippets.

@aliou
Created May 23, 2026 14:03
Show Gist options
  • Select an option

  • Save aliou/5da686ee976373b8e238699e01c82ae9 to your computer and use it in GitHub Desktop.

Select an option

Save aliou/5da686ee976373b8e238699e01c82ae9 to your computer and use it in GitHub Desktop.
Custom providers in Pi: Synthetic provider extension
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
// [!code fold:start] thinking level map
const THINKING_LEVEL_MAP = {
minimal: "low",
low: "low",
medium: "medium",
high: "high",
xhigh: "high",
} as const;
// [!code fold:end]
export default function (pi: ExtensionAPI) {
pi.registerProvider("synthetic", {
baseUrl: "https://api.synthetic.new/openai/v1",
apiKey: "SYNTHETIC_API_KEY",
api: "openai-completions",
// [!code fold:start] model definitions
models: [
{
id: "hf:zai-org/GLM-5",
name: "zai-org/GLM-5",
reasoning: true,
input: ["text"],
cost: {
input: 1,
output: 6,
cacheRead: 1,
cacheWrite: 0,
},
contextWindow: 196608,
maxTokens: 65536,
thinkingLevelMap: THINKING_LEVEL_MAP,
compat: {
supportsDeveloperRole: false,
supportsReasoningEffort: true,
},
},
{
id: "hf:moonshotai/Kimi-K2.5",
name: "moonshotai/Kimi-K2.5",
reasoning: true,
input: ["text", "image"],
cost: {
input: 0.45,
output: 3.4,
cacheRead: 0.45,
cacheWrite: 0,
},
contextWindow: 262144,
maxTokens: 65536,
thinkingLevelMap: THINKING_LEVEL_MAP,
compat: {
supportsDeveloperRole: false,
supportsReasoningEffort: true,
},
},
{
id: "hf:nvidia/Kimi-K2.5-NVFP4",
name: "nvidia/Kimi-K2.5-NVFP4",
reasoning: true,
input: ["text", "image"],
cost: {
input: 0.45,
output: 3.4,
cacheRead: 0.45,
cacheWrite: 0,
},
contextWindow: 262144,
maxTokens: 65536,
thinkingLevelMap: THINKING_LEVEL_MAP,
compat: {
supportsDeveloperRole: false,
supportsReasoningEffort: true,
},
},
{
id: "hf:MiniMaxAI/MiniMax-M2.5",
name: "MiniMaxAI/MiniMax-M2.5",
reasoning: true,
input: ["text"],
cost: {
input: 0.4,
output: 2,
cacheRead: 0.4,
cacheWrite: 0,
},
contextWindow: 191488,
maxTokens: 65536,
thinkingLevelMap: THINKING_LEVEL_MAP,
compat: {
supportsDeveloperRole: false,
supportsReasoningEffort: true,
},
},
{
id: "hf:zai-org/GLM-4.7-Flash",
name: "zai-org/GLM-4.7-Flash",
reasoning: true,
input: ["text"],
cost: {
input: 0.1,
output: 0.5,
cacheRead: 0.1,
cacheWrite: 0,
},
contextWindow: 196608,
maxTokens: 65536,
thinkingLevelMap: THINKING_LEVEL_MAP,
compat: {
supportsDeveloperRole: false,
supportsReasoningEffort: true,
},
},
{
id: "hf:nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4",
name: "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4",
reasoning: true,
input: ["text"],
cost: {
input: 0.3,
output: 1,
cacheRead: 0.3,
cacheWrite: 0,
},
contextWindow: 262144,
maxTokens: 65536,
thinkingLevelMap: THINKING_LEVEL_MAP,
compat: {
supportsDeveloperRole: false,
supportsReasoningEffort: true,
},
},
{
id: "hf:zai-org/GLM-4.7",
name: "zai-org/GLM-4.7",
reasoning: true,
input: ["text"],
cost: {
input: 0.45,
output: 2.19,
cacheRead: 0.45,
cacheWrite: 0,
},
contextWindow: 202752,
maxTokens: 65536,
thinkingLevelMap: THINKING_LEVEL_MAP,
compat: {
supportsDeveloperRole: false,
supportsReasoningEffort: true,
},
},
],
// [!code fold:end]
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment