npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pi-stef/azure-foundry

v0.1.3

Published

Azure Foundry and Azure OpenAI deployments as native Pi providers — config-driven, JSONC support, validation

Readme

@pi-stef/azure-foundry

Azure Foundry and Azure OpenAI deployments as native Pi providers — config-driven, JSONC support, validation.

Overview

This package registers Azure Foundry and Azure OpenAI deployments as native Pi providers from a JSONC configuration file. Each deployment becomes a provider whose model IDs are selected as <deployment-id>/<model-id>.

Key features:

  • Config-driven setup with JSONC support
  • Two API modes: openai-completions and azure-openai-responses
  • Custom headers support
  • Multiple deployments per configuration
  • Built-in validation and verification

Install

pi install npm:@pi-stef/azure-foundry

Start Pi once after installing. On first load, the extension creates:

~/.pi/azure-foundry/config.json
~/.pi/azure-foundry/config.schema.json

Configuration

Edit config.json, uncomment or add a deployment, and export the bearer-token env var named by apiKeyEnv.

export AZURE_API_KEY=...

Azure Foundry (openai-completions)

For Azure Foundry, use the modern OpenAI-compatible v1 endpoint:

{
  "id": "azure-foundry",
  "name": "Azure Foundry East US",
  "baseUrl": "https://<resource>.services.ai.azure.com/openai/v1/",
  "apiKeyEnv": "AZURE_API_KEY",
  "api": "openai-completions",
  "models": [
    {
      "id": "Kimi-K2.6",
      "name": "Kimi K2.6",
      "reasoning": false,
      "input": ["text"],
      "contextWindow": 128000,
      "maxTokens": 2048,
      "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
    }
  ]
}

Azure OpenAI (azure-openai-responses)

Classic Azure OpenAI via azure-openai-responses:

{
  "id": "aoai-eastus",
  "name": "Azure OpenAI East US",
  "baseUrl": "https://my-aoai.openai.azure.com",
  "apiKeyEnv": "AZURE_OPENAI_API_KEY",
  "api": "azure-openai-responses",
  "models": [
    {
      "id": "o4-mini",
      "name": "o4-mini",
      "reasoning": true,
      "input": ["text"],
      "contextWindow": 200000,
      "maxTokens": 16000,
      "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
    }
  ]
}

For azure-openai-responses, Pi normalizes the URL to <host>/openai/v1 and reads the API version from AZURE_OPENAI_API_VERSION, defaulting to v1. The host must end with .openai.azure.com or .cognitiveservices.azure.com.

Config Reference

Top-level shape:

{
  "$schema": "./config.schema.json",
  "deployments": []
}

Deployment fields:

| Field | Required | Notes | | --- | --- | --- | | id | Yes | Provider id. Lowercase letters, numbers, and hyphens. | | name | Yes | Display name. | | baseUrl | Yes | https:// endpoint. Rules depend on api. | | apiKeyEnv | Yes | Env-var name containing the bearer token. The secret is not stored in config. | | api | Yes | openai-completions or azure-openai-responses. | | authHeader | No | Defaults to true. Set false only if custom headers carry auth. | | headers | No | Map of header name to env-var name. Values must look like env-var names. | | models | Yes | One or more model entries. |

Multiple Deployments

{
  "deployments": [
    { "id": "foundry-east", "name": "Foundry East", "baseUrl": "https://east.services.ai.azure.com/openai/v1/", "apiKeyEnv": "AZURE_EAST_KEY", "api": "openai-completions", "models": [] },
    { "id": "foundry-west", "name": "Foundry West", "baseUrl": "https://west.services.ai.azure.com/openai/v1/", "apiKeyEnv": "AZURE_WEST_KEY", "api": "openai-completions", "models": [] },
    { "id": "aoai-eastus", "name": "AOAI East US", "baseUrl": "https://my-aoai.openai.azure.com", "apiKeyEnv": "AZURE_OPENAI_API_KEY", "api": "azure-openai-responses", "models": [] }
  ]
}

Custom Headers

"headers": {
  "api-key": "AZURE_HEADER_KEY",
  "x-ms-useragent": "AZURE_USER_AGENT"
}

Header values are env-var names. Pi resolves them at request time. If an env var is missing, Pi sends the literal configured string as a fallback, so keep config values as env-var names rather than secrets.

Verification

Run the package verifier after exporting the configured API key:

pnpm -F @pi-stef/azure-foundry verify

Use PI_AZURE_FOUNDRY_CONFIG=/path/to/config.json to verify a test config without touching the default file.

Common outputs:

| Output | Fix | | --- | --- | | 200 | The deployment is reachable. | | 401 | Check the env var named by apiKeyEnv. | | 404 | Check the model deployment id and base URL. | | timeout after 10s | Check network access, proxy, and endpoint host. |

Environment Variables

| Variable | Purpose | | --- | --- | | AZURE_API_KEY | Example bearer token env var for Azure Foundry deployments when apiKeyEnv is set to AZURE_API_KEY. | | PI_AZURE_FOUNDRY_CONFIG | Override config path for tests or alternate profiles. | | PI_AZURE_FOUNDRY_DEBUG | Set to 1 for debug logging. | | AZURE_OPENAI_API_VERSION | Optional Pi-side version for azure-openai-responses; defaults to v1. |

Troubleshooting

Authentication Fails

Check the env var named by apiKeyEnv is exported and contains the correct bearer token.

Model Not Found

Check the model deployment id and base URL. For azure-openai-responses, ensure the host ends with .openai.azure.com or .cognitiveservices.azure.com.

Timeout

Check network access, proxy, and endpoint host. Use PI_AZURE_FOUNDRY_DEBUG=1 for detailed logging.

Remove

pi remove @pi-stef/azure-foundry

Update

pi update @pi-stef/azure-foundry