Chat sessions in TypeScript
Same shape as Python. ai.chats.create({...}) returns a chat object you call sendMessage on. History is maintained in-memory.
Errors come back as ApiError
The TS SDK wraps API errors in ApiError with name: 'ApiError'. Check by name (since instanceof can be fragile across module boundaries) and read e.status and e.message.
Multimodal uses createUserContent + createPartFromUri
To send images or files alongside text in a single user turn, use the helper functions. They build the right parts structure for you.