@czottmann/pi-nebius-token-factory

Nebius Token Factory API provider extension for pi coding agent.

Packages

Package details

extension

Install @czottmann/pi-nebius-token-factory from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@czottmann/pi-nebius-token-factory
Package
@czottmann/pi-nebius-token-factory
Version
1.0.1
Published
Aug 8, 2026
Downloads
329/mo · 25/wk
Author
czottmann
License
MIT
Types
extension
Size
19.1 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./extensions/nebius-token-factory.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@czottmann/pi-nebius-token-factory

Nebius Token Factory provider extension for pi. It registers tool-capable Nebius Token Factory models under the nebius-token-factory provider.

Install

From npm:

pi install npm:@czottmann/pi-nebius-token-factory

From a local checkout:

cd path/to/pi-nebius-token-factory
npm install
pi install "$PWD"

Set up auth

Use pi's API-key flow:

pi
/login
# Choose "Use an API key", then "Nebius Token Factory".

Or set an environment variable before starting pi:

export NEBIUS_TOKEN_FACTORY_API_KEY=your-key-here

Nebius Token Factory currently uses static API keys. It should appear under API keys in /login, not under subscriptions.

Use

List registered models:

pi --list-models | grep nebius-token-factory

Start pi with Nebius Token Factory:

pi --provider nebius-token-factory

In interactive mode, /nebius-token-factory-models lists the Nebius Token Factory models registered by the extension.

How it works

The extension registers the nebius-token-factory provider on startup, so it appears under API keys in /login even before you have set a key. When NEBIUS_TOKEN_FACTORY_API_KEY is set, the catalog is fetched at load; otherwise the provider starts without models until you save a key in /login, after which pi refreshes the provider and the models appear — no restart needed.

The catalog fetch calls GET https://api.tokenfactory.nebius.com/v1/models?verbose=true and keeps models that support tool calling. Fetches have a per-attempt timeout and retry transient failures (network errors, HTTP 429/5xx) with backoff. The last successfully loaded catalog is persisted and restored at startup, so models stay selectable even when the API is unreachable — the cached catalog appears in the model picker immediately, while a refresh is still running in the background. Note that non-interactive runs (pi --list-models) do not refresh provider catalogs, so in those modes models come from the NEBIUS_TOKEN_FACTORY_API_KEY pre-fetch or the persisted catalog.

Model metadata is derived from the Nebius Token Factory catalog:

  • context_length becomes pi's context window.
  • pricing.prompt and pricing.completion (per-token) become pi's per-million cost metadata.
  • A modality with image input (e.g. text+image->text) adds image input support.
  • The reasoning feature marks a model as reasoning-capable.

The catalog requires authentication: NEBIUS_TOKEN_FACTORY_API_KEY or a saved key from /login must be present for models to load. The same key is used for inference.

Development

npm run check
npm run build
pi -e . --provider nebius-token-factory

Publishing

GitHub Actions publishes the package to npm when a GitHub Release is published. The release tag must match package.json exactly, with or without a leading v (v1.0.0 and 1.0.0 both work for version 1.0.0).

The workflow uses npm Trusted Publishing, so it does not need an npm token secret. Configure this package on npm with this repository and workflow file (.github/workflows/publish.yml). The workflow builds the package, runs npm run check, and publishes with npm provenance.

Author

Carlo Zottmann, carlo@zottmann.dev