Google AI Chat Service

The Google AI Chat Service provides an interface to interact with Google's Gemini models. It supports conversational history, file attachments, and session management.

Generate Content (POST)

Send a prompt to the AI model and receive a response.

Method Path Authentication
POST /resource/googleai Required

Request Body (JSON)

Field Type Required Description
prompt String Yes The text prompt to send to the AI.
model String No The model name (e.g., gemini-2.5-flash). Defaults to gemini-2.5-flash.
attachment_path String No The path to a file in blob storage to be used as context (e.g., an image or document).
session_id String | Integer No The ID of an existing chat session. If provided, the AI will consider the chat history. Can be an integer or an encrypted string.

Response Body (JSON)

Field Type Description
response String The text response generated by the AI.
session_id String The encrypted session ID. Use this in subsequent requests to maintain conversation context.
subject String The automatically generated subject for the session (returned only for new sessions).

Chat History

When a session_id is provided, the service automatically retrieves the last 20 messages from the database to provide context to the AI model. This allows for multi-turn conversations where the AI remembers previous interactions.

ℹ️

History Window

Only the 20 most recent messages are sent to the model to optimize token usage and performance.

Attachments

The service supports multimodal input. By providing an attachment_path, you can send images, PDFs, or other supported file types along with your prompt.