A streamlined REST API for interacting with the Gemini models on Google Vertex AI.
| File | Description |
|---|---|
| index.js | The main application file. Sets up the Express server, middleware, and defines the consolidated API routes (/v1/chat, /v1/multimodal, /healthz). |
| gemini-service.js | The core API logic. Abstracts all interaction with the Vertex AI Gemini models, providing clean functions for text generation and multimodal content analysis. |
The API is simplified with a unified chat endpoint and a single multimodal endpoint.
- Health Check Checks if the Express server is running.
| Method | Path |
|---|---|
| GET | /healthz |
curl -X GET http://localhost:8080/healthz
# Expected Response: {"message":"CLZ LLM API running"}
Handles all text-based chat and role-playing using query parameters to set the bot's persona and the user's message. Maps to the gemini-service.js's generateText function.
| Method | Path | Query Params | Default Value |
|---|---|---|---|
| GET | /v1/chat | message | "Help me to learn Google Cloud" |
| name | "lab bot" | ||
| role | "technology" | ||
| knowledge | "Google Cloud" |
curl -X GET 'http://localhost:8080/v1/chat'
Analyzes content from Google Cloud Storage (GCS) URIs for files like Video, Audio, or PDF. Maps to the gemini-service.js's generateContentWithFile function.
| Method | Path | Query Params | Default Value |
|---|---|---|---|
| GET | /v1/multimodal | message | "Provide a description/summary of this file" |
| fileUri | "gs://cloud-samples-data/generative-ai/video/pixel8.mp4" |
Analysis requires a publically accessible asset e.g. bucket with allUsers.
- Example: Analyse a Video
curl -X GET 'http://localhost:8080/v1/multimodal?message=What%20is%20the%20main%20theme%20of%20this%20video&fileUri=gs://cloud-samples-data/generative-ai/video/pixel8.mp4'
- Example: Summarise a PDF
curl -X GET 'http://localhost:8080/v1/multimodal?message=Provide%20a%20concise%20summary%20of%20the%20document&fileUri=gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf'
Contributions are always welcome - see CONTRIBUTING.md for more information.
GPE-3.0 - see LICENSE for more information.
Copyright (c) CmdLineZero 2025