Chat is a thin wrapper over generate_content
client.chats.create() returns a chat session that maintains history. Each send_message appends the user turn, calls generate_content with the full history, and appends the model's reply. You could write the same thing yourself in 20 lines — the wrapper just saves you that 20 lines and the bug where you forget to append the model turn.
Streaming chat exists too
chat.send_message_stream(...) is the streaming variant. Same iterator shape as generate_content_stream.
Inspect history when debugging
chat.get_history() returns the full conversation as list[Content]. Useful when you want to print, persist, or rewind state.
Errors are a three-class hierarchy
errors.APIError— base class. Catch this if you don't care which sub-class.errors.ClientError— 4xx (400, 401, 403, 404, 429). Your fault: bad request, bad auth, rate limit.errors.ServerError— 5xx (500, 503). Their fault: retry with backoff.
The HTTP status is on e.code; the human-readable message is on e.message.