Inference Provider API

A NIP-07-style API for AI.
Inference Provider API

Proposal: Inference Provider API

The Inference Provider API (IPA) is a proposed browser standard that allows web applications to request AI inference from a user-approved browser extension without ever accessing API keys.

Think of it as NIP-07 for inference providers.

The Problem

Today, every AI-powered web app has to:

  • Ask users for API keys
  • Proxy requests through their own backend
  • Charge subscriptions for inference
  • Integrate every provider separately

This creates a poor user experience and makes inference features harder to build.

The Idea

A browser extension securely stores the user’s inference providers and API keys, then exposes a standard interface to web apps.

window.inference.request(...)

The extension prompts the user for permission whenever a site requests inference.

The website never sees the API keys.

Example

const response = await window.inference.request({
  method: "chat",

  preferredModel: "gpt-5",

  messages: [
    {
      role: "user",
      content: "Summarize this Nostr note."
    }
  ]
})

User Permission

When a website requests inference, the extension displays a permission dialog.

primal.net wants to use inference

Suggested model
GPT-5

Use:

○ GPT-5
● Claude Sonnet 4
○ PPQ Auto
○ Gemma 4 (Local)

Estimated Cost
$0.0012

[Allow Once]
[Always Allow]
[Deny]

The application can suggest a model.

The user chooses the provider and model.

Users Choose Their Provider

The same application could work with:

  • OpenAI
  • Anthropic Claude
  • Google Gemini
  • xAI Grok
  • OpenRouter
  • ppq.ai
  • Routstr
  • Ollama
  • LM Studio
  • etc.

The application doesn’t care where the inference comes from.

Example Configuration

Default Provider
✓ Claude

Default Model
✓ Claude Sonnet 4

Available Providers

• OpenAI
• Claude
• ppq.ai
• Routstr
• Ollama

Tomorrow the user switches to OpenAI.

The application doesn’t change.

Next week they switch to ppq.ai.

The application doesn’t change.

Eventually they buy a powerful local inference machine and switch to Ollama.

The application still doesn’t change.

Permission Model

The extension controls permissions per origin.

primal.net

Allowed

✓ Chat
✗ Images
✗ Embeddings

Preferred Model
GPT-5

Default Model for this Site
Claude Sonnet 4

Always use this model ✓

Benefits

  • Users own their API keys.
  • Websites never store secrets.
  • BYOK becomes the default.
  • Inference features become dramatically easier to add.
  • Users choose their preferred provider and model.
  • Applications become provider agnostic.
  • Local inference works automatically.

Possible Future Methods

window.inference.request({
  method: "chat"
})

window.inference.request({
  method: "embed"
})

window.inference.request({
  method: "image"
})

window.inference.request({
  method: "transcribe"
})

window.inference.request({
  method: "search"
})

Example Use Cases

  • A “Grok” button on every Nostr note.
  • AI-powered documentation sites.
  • Browser-based coding tools.
  • Research assistants.
  • Translation.
  • Writing assistance.
  • Local-first applications.
Write a comment