You never construct one. It comes from api.models.create() for a new conversation, or api.models.get(id) for one you are resuming.
The surface
| Member | Does |
|---|---|
| generate({ inputs, outputs }) | Asks. This is the one that spends. |
| getHistory() | Reads what was said, without adding to it. |
| destroy() | Deletes the session and its messages. |
| data | The configuration, as a plain object. |
const assistant = await api.models.create({ model: "gemini-3.5-flash" });
assistant.id; // keep this — it is all you need to come back
assistant.model;
assistant.settings;
assistant.schema;
assistant.memory; // true unless you asked otherwise
assistant.title; // named by the first message
assistant.createdAt;
assistant.updatedAt;assistant = api.models.create(model="gemini-3.5-flash")
assistant.id # keep this — it is all you need to come back
assistant.model
assistant.settings
assistant.schema
assistant.memory # True unless you asked otherwise
assistant.title # named by the first message
assistant.created_at
assistant.updated_atThe shape of using one
// Open, and remember which conversation this is
const assistant = await api.models.create({ model: "gemini-3.5-flash" });
await db.save({ userId, sessionId: assistant.id });
// Ask, as many times as the conversation needs
await assistant.generate({ inputs: [{ type: "text", content: "…" }] });
// Later, anywhere, any process
const again = await api.models.get(await db.load(userId));
// And when it is over
await again.destroy();# Open, and remember which conversation this is
assistant = api.models.create(model="gemini-3.5-flash")
db.save(user_id=user_id, session_id=assistant.id)
# Ask, as many times as the conversation needs
assistant.generate(inputs=[{"type": "text", "content": "…"}])
# Later, anywhere, any process
again = api.models.get(db.load(user_id))
# And when it is over
again.destroy()The object is a handle, not the conversation
The conversation is on the server. Two handles to the same id are the same conversation, and nothing is lost by throwing one away.
What you cannot change
The model, the settings and the schema are fixed when the session is created. There is no method to change them — to answer differently, open another session. That is deliberate: a conversation whose rules changed halfway is one whose history no longer explains its answers.