Skip to main content
When you generate an app with the AI toggle enabled, AppBlips injects the blip global into your app’s JavaScript environment. The main entry point is blip.ai.text(), but AppBlips also exposes BLIP.AI.TEXT (uppercase) and the legacy alias ai.chat — all three point to the same function. You can use whichever form you prefer in your prompt, and the generated code will call the API correctly.

blip.ai.text(messages, options)

Sends a list of messages to the configured AI provider and returns the model’s reply. In BYOK mode, if no provider has been connected yet, this call automatically opens the Connect your AI provider dialog before proceeding.
array
required
An array of message objects that form the conversation. Each object must have a role ("user" or "assistant") and a content string.
object
Optional settings for this request.
Returns: Promise<{ text: string }> — a Promise that resolves to an object with a single text property containing the complete response. Basic example:
Streaming example:
Multi-turn conversation example:

blip.ai.configure()

Opens the Connect your AI provider dialog programmatically, letting the user update their endpoint, model, and API key at any time. Returns a Promise that resolves when the user saves their settings and rejects with a configuration_required error if they cancel. In relay mode this resolves immediately without showing any dialog, because the provider is configured server-side.

blip.ai.isConfigured()

Synchronous. Returns true if a provider is currently connected (BYOK credentials are stored in this browser) or if the mode is relay. Returns false if the user has not yet connected a provider in BYOK mode. Use this to decide whether to show a setup prompt before the user’s first AI action.

blip.ai.clearConfiguration()

Disconnects the currently configured provider and removes stored credentials from both sessionStorage and localStorage. After calling this, isConfigured() returns false and the next blip.ai.text() call will open the Connect your AI provider dialog again. This has no effect in relay mode.

Error Handling

All blip.ai.text() errors are thrown as Error objects with a code property. Wrap your AI calls in try/catch and inspect error.code to handle different failure cases gracefully.
The full set of error codes:

Aliases

AppBlips exposes blip.ai.text under two additional names for convenience:
  • BLIP.AI.TEXT — uppercase alias; identical to blip.ai.text. Useful if your prompt used uppercase and the generated code uses it.
  • ai.chat — legacy alias from earlier versions of AppBlips; still supported.
All three call the same underlying function and behave identically.