← All examples

AI with vos.ai

Check whether AI is available, ask one-off questions, hold a conversation and get structured JSON back. AI runs under the user's VibeOS plan and credits, so always handle "not available".

1Check access first

canUse() never throws. Call it before showing AI features so you can explain problems instead of failing.

2Ask once

One question, one answer. The optional instructions steer tone and format.

3Chat with memory

Send the whole conversation each time and the AI remembers earlier messages. The Result panel shows the exact messages array sent.

You're chatting with a friendly assistant.

4Get JSON back

Give the AI an example of the shape you want and get a real object, ready to use in your app.

5Messages for every problem

What aiProblem() (below) tells your users for each canUse() code.

WaitingRun something on the left
// The exact call appears here
Return values and errors show up here, exactly as your code would get them.

Activity

Every call this page made. Click one to see its result again.

    Use it in your app

    The helpers this page runs on. Copy them into your app as they are.