v148 · AI · Prompt API

Prompt Playground

Chat with Gemini Nano running locally in your browser. No server, no API key, no network round-trip for inference. Uses LanguageModel.create() and session.promptStreaming().

Checking the Prompt API and model availability…

Prompt API unavailable in this browser profile

The interface, model, and hardware requirements are separate checks. A Chrome version alone does not prove availability.

Session config

Send a message to start. The model runs entirely in your browser.

API code

// Check availability for the text languages this session will use
const availability = await LanguageModel.availability({
  expectedInputs: [{ type: 'text', languages: ['en'] }],
  expectedOutputs: [{ type: 'text', languages: ['en'] }],
});
// Current values: 'available' | 'downloadable' | 'downloading' | 'unavailable'
// Earlier prototypes used: 'readily' | 'after-download' | 'no'

// Create a session
const session = await LanguageModel.create({
  initialPrompts: [{
    role: 'system',
    content: 'You are a helpful assistant.',
  }],
  temperature: 1.0,
  topK: 3,
});

// Stream a response
const stream = session.promptStreaming('Summarize CSS gap decorations');
for await (const chunk of stream) {
  process.stdout.write(chunk); // incremental text
}

// Check token budget
console.log(session.contextUsage, '/', session.contextWindow);

// Clone for a parallel conversation
const session2 = await session.clone();

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗