charge.ai.chat() reference
Every option, the reply object and the other calls.
Signature
charge.ai.chat(input, options?) → Promise<Reply>
input
A string, or an array of { role: 'system' | 'user' | 'assistant', content: string }.
options
lang: two-letter language of the reply, likehi,taoren.tier:'standard'(₹0.10, default) or'premium'(₹0.25, cloud only).mode:'auto'(default: device first, then cloud),'device'or'cloud'.stream:truereturns an async iterable of text, with a.resultpromise.onStage(stage, status, detail): progress updates for a loading state.
Reply
Reply
{
text: string,
route: 'device' | 'cloud',
model: string,
region: 'in' | 'abroad' | 'device',
costPaise: number, // 100 paise = ₹1
latencyMs: number,
} Other calls
charge.signIn()andcharge.signOut(): sign the user in or out of your app.charge.signedIn: whether the user is signed in to your app.await charge.balance(): the user's balance in paise, ornull.charge.topUp(): open the UPI top-up sheet.charge.account(): open the user's ChargeMyAI account in a new tab.charge.configure({ lang }): language of the sign-in and payment sheets (en,hi,ta).
Read next
Still stuck? Talk to us and we'll help.