api.models

list()

api.models.list({ limit }) → Promise<Session[]>

Sessioni di modello del cont, più recentmente usat prima. Dati puri — questo è l'inventario, non la maniglia.

GET /api/ai/modelsfreeplain objects
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Parâmetros

limitinteger

Quants a restituir. Predefinit a 30, plafot a 100, mai sotto 1.

Un valore sopra il capèn è abbattut anziché negüit, quindi chiedere mille discretamente ti da centa. Non c'è cursor: questo risponde «l'N più recente», che è ciò che un screen d'inventario necessita.

Retorno

[
  {
    id: "…",
    model: "gemini-3.5-flash",
    storage: null,
    settings: { instructions: "…" },
    schema: null,
    memory: true,
    title: "Résume ce contrat.",
    createdAt: "2026-10-01T09:12:44.102Z",
    updatedAt: "2026-10-07T11:02:08.400Z"
  }
]
[
    {
        "id": "…",
        "model": "gemini-3.5-flash",
        "storage": None,
        "settings": {"instructions": "…"},
        "schema": None,
        "memory": True,
        "title": "Résume ce contrat.",
        "createdAt": "2026-10-01T09:12:44.102Z",
        "updatedAt": "2026-10-07T11:02:08.400Z",
    }
]
Non sono oggetti AssistantSession

Non c'è genera() nels. Prende l'identificazion e passa-la per get() quando si desidera condure una conversazion on — list() è per mostrare ce existe.

Titulo, e de da qui viene

Il primo messaggio d'usuari nomi la sessione — trimese a una riga, tagliat a circa setenta caracteres. Nessun modeli è chiamato a produla, quindi non costa nulla e è literale piuttosto que astuto. Una sessione che non ha mai fost usata ha un titulo vazio.

L'ordine è attività, non creazione

Sessionis revend tried updatedAt, quindi la última generat in è prima. It's usualmente lo que una list deve mostrar; tried on createdAt si tu sieda se li vuoi in ordine di loro sono stati aperti.

const sessions = await api.models.list({ limit: 50 });

// What a user would recognise
for (const s of sessions) {
  const when = new Date(s.updatedAt).toLocaleDateString();
  console.log(`${s.title || "(empty)"} · ${s.model} · ${when}`);
}

// Sessions that were opened and never used
const unused = sessions.filter((s) => !s.title);

// Carry one on
const assistant = await api.models.get(sessions[0].id);
from datetime import datetime

sessions = api.models.list(limit=50)

# What a user would recognise
for s in sessions:
    when = datetime.fromisoformat(s["updatedAt"].replace("Z", "+00:00")).date()
    print(f"{s['title'] or '(empty)'} · {s['model']} · {when}")

# Sessions that were opened and never used
unused = [s for s in sessions if not s["title"]]

# Carry one on
assistant = api.models.get(sessions[0]["id"])

Mantenendo-lo ordinato

Sessioni accumula: ogni create() deixa uno, inclusa la una prova aperta. Nada expire per te.

const sessions = await api.models.list({ limit: 100 });
const month = Date.now() - 30 * 24 * 60 * 60 * 1000;

const stale = sessions.filter(
  (s) => !s.title && Date.parse(s.updatedAt) < month,   // opened, never used, and old
);

for (const s of stale) {
  await (await api.models.get(s.id)).destroy();
}
from datetime import datetime, timedelta, timezone

sessions = api.models.list(limit=100)
month = datetime.now(timezone.utc) - timedelta(days=30)

stale = [s for s in sessions   # opened, never used, and old
         if not s["title"] and datetime.fromisoformat(s["updatedAt"].replace("Z", "+00:00")) < month]

for s in stale:
    api.models.get(s["id"]).destroy()
Eliminar una sessione cancella i suoi messaggi

It is the point, and it it's non reversibilis. LegdHistory() prima se la conversa era valsa la pena mantene.