Anthropic (Claude Pro/Max), OpenAI Codex (ChatGPT Plus/Pro), and GitHub Copilot require OAuth authentication rather than static API keys. OAuth functions are available from theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/earendil-works/pi/llms.txt
Use this file to discover all available pages before exploring further.
@earendil-works/pi-ai/oauth entry point, which is Node.js only.
Imports
CLI login (quickest start)
auth.json in the current directory.
Programmatic login flow
Use the login functions when you need to control credential storage or integrate with your own auth infrastructure. The callbacks let you drive the interactive device-flow UI:Using OAuth tokens
UsegetOAuthApiKey() to extract a current API key from stored credentials, automatically refreshing if the token has expired. Save the returned credentials to persist the refresh:
Vertex AI
Vertex AI supports two authentication modes:- API key
- Application Default Credentials (ADC)
Set
GOOGLE_CLOUD_API_KEY or pass apiKey in call options. Project and location are not required when using an API key.Provider notes
OpenAI Codex
OpenAI Codex
Requires a ChatGPT Plus or Pro subscription. Provides access to GPT-5.x Codex models with extended context windows and reasoning capabilities.The library automatically handles session-based prompt caching when
sessionId is provided in stream options. You can set transport in stream options to "sse", "websocket", or "auto" for transport selection. When using WebSocket with a sessionId, connections are reused per session and expire after 5 minutes of inactivity.Azure OpenAI
Azure OpenAI
Uses the Responses API only. Set
AZURE_OPENAI_API_KEY and either AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME.AZURE_OPENAI_BASE_URLsupports bothhttps://<resource>.openai.azure.comandhttps://<resource>.cognitiveservices.azure.com; root endpoints are normalized to.../openai/v1automatically- Use
AZURE_OPENAI_API_VERSION(defaults tov1) to override the API version - Deployment names are treated as model IDs by default; override with
azureDeploymentNameorAZURE_OPENAI_DEPLOYMENT_NAME_MAPusing comma-separatedmodel-id=deploymentpairs (e.g.gpt-4o-mini=my-deployment,gpt-4o=prod) - Legacy deployment-based URLs are intentionally unsupported
GitHub Copilot
GitHub Copilot
If you receive a “The requested model is not supported” error, enable the model manually in VS Code:
- Open Copilot Chat
- Click the model selector
- Select the model (it may show a warning icon)
- Click “Enable”