@usine/agents/pi/authentication
Type Aliases
Section titled “Type Aliases”PiAuthentication
Section titled “PiAuthentication”PiAuthentication = {
_tag:"ApiKey"; } | {_tag:"OAuth";subscription:boolean; }
PiPool
Section titled “PiPool”PiPool =
Extract<BillingPool,"apiKeys"|"chatgptPlan">
Variables
Section titled “Variables”piAuthentication
Section titled “piAuthentication”
constpiAuthentication: (check,subscription) =>PiAuthentication|undefined
Pi’s credential check for a provider as the pool decision reads it; subscription tells whether its OAuth login is a subscription.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
check |
{ type: "api_key" | "oauth"; } | undefined |
subscription |
boolean |
Returns
Section titled “Returns”PiAuthentication | undefined
requiredPiPool
Section titled “requiredPiPool”
constrequiredPiPool: (provider) =>PiPool
The billing pool the chosen Pi provider spends from, checked before launch.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
provider |
string |
Returns
Section titled “Returns”resolvePiPool
Section titled “resolvePiPool”
constresolvePiPool: (provider,authentication) =>PiPool|undefined
Returns the billing pool of the credential that pays for the model request.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
provider |
string |
authentication |
PiAuthentication | undefined |
Returns
Section titled “Returns”PiPool | undefined
splitPiModel
Section titled “splitPiModel”
constsplitPiModel: (model) => {modelId:string;provider:string; } |undefined
The provider and model id of a provider/model name, the provider deciding the credential; undefined unless both parts are present.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
model |
string |
Returns
Section titled “Returns”{ modelId: string; provider: string; } | undefined