Skip to content

@usine/agents/pi/authentication

PiAuthentication = { _tag: "ApiKey"; } | { _tag: "OAuth"; subscription: boolean; }


PiPool = Extract<BillingPool, "apiKeys" | "chatgptPlan">

const piAuthentication: (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.

Parameter Type
check { type: "api_key" | "oauth"; } | undefined
subscription boolean

PiAuthentication | undefined


const requiredPiPool: (provider) => PiPool

The billing pool the chosen Pi provider spends from, checked before launch.

Parameter Type
provider string

PiPool


const resolvePiPool: (provider, authentication) => PiPool | undefined

Returns the billing pool of the credential that pays for the model request.

Parameter Type
provider string
authentication PiAuthentication | undefined

PiPool | undefined


const splitPiModel: (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.

Parameter Type
model string

{ modelId: string; provider: string; } | undefined