andersea-pi-scaleway-provider

内容来源:README.md(说明文档) · 原始地址 · 查看安装指南

原始内容

Scaleway Generative AI Extension for Pi

A minimal Pi extension that registers Scaleway's Generative APIs as a native Pi provider.

Installation

# Production — install via npm (recommended)
pi install npm:@andersea/pi-scaleway-gen

# Or install from git
pi install git:github.com/andersea/pi-scaleway-provider

# Development — load directly from source
pi -e ./extensions/index.ts

Authentication

Scaleway supports two authentication methods:

Method 1: Interactive Login (Recommended)

# Start Pi, then run:
/login scaleway
# Enter your API key when prompted

Credentials are stored securely in ~/.pi/agent/auth.json and persist across sessions.

Method 2: Environment Variable

export SCW_SECRET_KEY="scw_..."

💡 Note: SCW_SECRET_KEY is the official Scaleway convention. Get your API key from Scaleway Console → Credentials → API Keys.

Credential Resolution

Pi resolves credentials in this order: auth.json → environment variable.

Usage

Select a Scaleway Model

# List available Scaleway models
/model scaleway/

# Use a specific model
/model scaleway/gpt-oss-120b

Development

# Install dependencies
npm install

# Build (optional - jiti loads TS directly)
npm run build

# Lint
npm run lint

# Test with Pi
SCW_SECRET_KEY=scw_xxx pi -e ./extensions/index.ts

Architecture

This extension uses Pi's provider registration pattern:

pi.registerProvider("scaleway", {
  name: "Scaleway Generative AI",
  baseUrl: "https://api.scaleway.ai/v1",
  apiKey: "$SCW_SECRET_KEY",
  authHeader: true,
  api: "openai-completions",
  models: getModels()
});

All Scaleway models use the openai-completions API — including gpt-oss-120b, which the Scaleway docs suggest must use the Responses API. In practice, Scaleway's /v1/responses endpoint rejects the include field that Pi sends for reasoning models, so all models are routed through chat completions.

Models are defined in extensions/models.ts as a static, curated list sourced from Scaleway's supported models page.

Only serverless chat/generation models are included — non-chat models (audio, embeddings), EOL models, and dedicated-only models are excluded.

License

MIT