pi.registerProvider(). This enables proxies, self-hosted deployments, OAuth/SSO authentication, and custom API implementations.
Quick Start
Create an extension that registers a provider:Use Cases
- Proxy
- Custom Endpoint
- OAuth/SSO
Redirect an existing provider through a corporate proxy:
Override Existing Provider
When only
baseUrl and/or headers are provided (no models), all existing models for that provider are preserved with the new endpoint.Register New Provider
OAuth Support
Add authentication that integrates with/login:
Custom Streaming API
For providers with non-standard APIs, implementstreamSimple:
Study the existing provider implementations in
packages/ai/src/providers/ before writing your own.Complete Example
Here’s a complete custom provider with OAuth:custom-provider-anthropic/index.ts
packages/coding-agent/examples/extensions/custom-provider-anthropic/ for the complete working example.
Unregister Provider
Remove a provider:Reference
Config Options
Model Definition
Next Steps
- See Building Extensions for extension basics
- See Creating Skills for specialized workflows
- Check
packages/coding-agent/examples/extensions/custom-provider-*for examples