Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Tools
  3. Gemini AI Connector for | Google Gemini API Integration v 18.0
  4. Sales Conditions FAQ

Gemini AI Connector for | Google Gemini API Integration

by Steven Marp https://apps.odoo.com/apps/browse?order=Newest&repo_maintainer_id=512936
Odoo

$ 39.99

v 18.0 Third Party
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 381
Technical Name sm_gemini_connector
LicenseOPL-1
Websitehttps://apps.odoo.com/apps/browse?order=Newest&repo_maintainer_id=512936
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 381
Technical Name sm_gemini_connector
LicenseOPL-1
Websitehttps://apps.odoo.com/apps/browse?order=Newest&repo_maintainer_id=512936
  • Description
  • Documentation
  • License

Connect Odoo to Google Gemini Once

Configure Gemini from Odoo Settings and let other AI modules reuse the same connection. This connector is built as the shared base for AI Sales, AI CRM, AI Helpdesk, AI Inventory, and custom Gemini-powered Odoo apps.

Real Odoo and Google AI Studio Setup

Configure the connector in Odoo, test Gemini from Settings, and monitor Gemini quota from Google AI Studio.

Gemini connection test in Odoo Settings
Google AI Studio Gemini rate limits

Key Features

1 Secure Gemini Configuration

Store the Gemini API key in Odoo system parameters, configure the API endpoint, choose the request timeout, and keep Gemini access centralized for every dependent AI module.

Configure Gemini once from Odoo Settings

Switch Gemini models without code changes

2 Model Selector and Custom Model ID

Select popular Gemini models such as Gemini 2.5 Flash Lite, Gemini 2.5 Flash, or Gemini 2.5 Pro. Use Custom Model ID when Google AI Studio exposes a new model.

3 Reusable Python Service

Build AI features faster with a reusable Odoo service: call Gemini, track usage, parse JSON responses, and handle API errors without duplicating provider code in every module.

One service method for dependent apps

Monitor token usage and control limits

4 Token Tracking and Quota Guard

Track total token usage from Gemini responses and set a monthly token limit to prevent uncontrolled usage during demos, testing, or production.

5 Connection Test from Settings

Validate the API key, selected model, endpoint, request timeout, and Gemini quota directly from Odoo Settings before dependent modules use the connector.

Confirm Gemini works before building features

How It Works

1

Configure Gemini

Enter the Gemini API key, choose a model, and save settings.

2

Test Connection

Confirm API key, model, endpoint, and quota from Odoo Settings.

3

Build AI Apps

Use the connector service from any Odoo module that needs Gemini.

Highlighted Features

Google Gemini connector · Google AI Studio API key · Gemini model selector · Custom model ID · Token tracking · Monthly limit guard · Connection testing · JSON parser helper · Reusable Odoo service · Odoo 18 AI foundation module

Gemini AI Connector for Odoo - Odoo 18 User and Technical Guide

Table of Contents

  • 1. Overview
  • 2. What the Module Adds
    • Settings UI
    • Reusable Service
    • JSON Helper
    • Configuration Parameters
  • 3. Installation
    • Dependencies
  • 4. Gemini Configuration
    • Get API Key
    • Configure Odoo
    • Model Selection
    • Custom Model ID
  • 5. Connection Test
    • Common Failure Reasons
      • Missing API Key
      • Invalid API Key
      • Quota Exceeded
      • Wrong Model ID
      • Wrong API Base URL
  • 6. Developer Usage
    • Basic Chat Call
    • Direct Gemini Call
    • System Prompt
    • Model Override
    • JSON Response Parsing
  • 7. API Behavior
    • Endpoint
    • Headers
    • Payload
    • Generation Config
  • 8. Usage Tracking
    • Monthly Token Limit
    • Reset Counter
  • 9. Security Notes
    • API Key Storage
    • Error Sanitization
  • 10. Troubleshooting
    • Test Connection Fails
    • Quota Error
    • Module Does Not Appear in Settings
  • 11. Technical Reference
    • Python Model
    • Important Methods
    • Settings Fields
    • Compatibility
  • 12. Support and Maintenance

1. Overview

The Gemini AI Connector for Odoo module connects Odoo with Google Gemini through one reusable connector service.

It helps implementers and developers:

  • Store the Gemini API key once in Odoo.
  • Select a Gemini model from Odoo Settings.
  • Use a custom Gemini model ID when Google releases new models.
  • Configure the Google Generative Language API endpoint.
  • Test Gemini connectivity from Odoo Settings.
  • Track token usage returned by Gemini.
  • Enforce a monthly token usage limit.
  • Reuse the same Gemini service from other Odoo modules.
  • Parse JSON responses generated by AI prompts.

The module is designed as a foundation dependency for Gemini-powered Odoo apps such as AI Sales, AI CRM, AI Helpdesk, AI Inventory, AI Accounting assistants, workflow automation tools, and custom customer projects.


2. What the Module Adds

Settings UI

The module adds a Gemini AI Connector block in Odoo Settings with:

  • Gemini API Key.
  • Gemini model selector.
  • Custom Gemini model ID.
  • Gemini API Base URL.
  • Request Timeout.
  • Test Gemini Connection action.
  • Total Tokens Used counter.
  • Monthly Token Limit.
  • Reset Counter action.

Reusable Service

The module registers this Odoo abstract model:

sm.gemini.connector.service

Dependent modules can call:

env['sm.gemini.connector.service'].call_ai_chat(messages)

or directly:

env['sm.gemini.connector.service'].call_gemini_chat(messages)

JSON Helper

The connector also includes:

env['sm.gemini.connector.service'].parse_json_response(response)

This helper removes common Markdown code fences and extracts JSON blocks from Gemini responses.

Configuration Parameters

The connector stores settings in ir.config_parameter:

  • sm_gemini_connector.gemini_api_key
  • sm_gemini_connector.gemini_model
  • sm_gemini_connector.gemini_custom_model
  • sm_gemini_connector.gemini_api_base_url
  • sm_gemini_connector.request_timeout
  • sm_gemini_connector.total_tokens_used
  • sm_gemini_connector.monthly_token_limit

3. Installation

  1. Copy the sm_gemini_connector folder into an Odoo addons path.
  2. Restart Odoo.
  3. Update Apps List.
  4. Install Gemini AI Connector for Odoo.

Command-line example:

python3 ~/odoo/odoo-18/odoo-server \
   -c ~/odoo/conf/odoo.conf \
   -d your_database \
   -i sm_gemini_connector \
   --stop-after-init \
   --no-http

Dependencies

The module depends on:

  • base
  • web

No Sales, CRM, Inventory, Accounting, or Helpdesk dependency is required. This is intentional so the connector can be reused by many app types.


4. Gemini Configuration

Get API Key

  1. Open Google AI Studio.
  2. Create or select a project.
  3. Generate a Gemini API key.
  4. Copy the API key.

Configure Odoo

  1. Open Settings -> Gemini AI Connector.

  2. Enter Gemini API Key.

  3. Select a Gemini model.

  4. Keep API Base URL as:

    https://generativelanguage.googleapis.com/v1beta
    
  5. Set request timeout if needed.

  6. Click Save.

  7. Click Test Gemini Connection.

Model Selection

The connector currently includes:

  • Gemini 2.5 Flash Lite.
  • Gemini 2.5 Flash.
  • Gemini 2.5 Pro.
  • Gemini Flash Latest.
  • Gemini 2 Flash.
  • Gemini 2 Flash Lite.
  • Custom Model ID.

Recommended starting model:

gemini-2.5-flash-lite

This model is usually a practical first choice for demos and lightweight AI automations.

Custom Model ID

Use Custom Model ID when Google exposes a model not listed in the dropdown.

Example:

gemini-2.5-flash-lite

5. Connection Test

The Test Gemini Connection button sends a small prompt to Gemini:

Reply with exactly: Gemini connected successfully.

If the connection works, Odoo shows a success notification.

If the connection fails, the notification shows a sanitized error message. The connector does not expose the API key in error messages.

Common Failure Reasons

Missing API Key

Cause:

  • Gemini API Key is empty.

Fix:

  • Add the key in Settings and save.

Invalid API Key

Cause:

  • Key was copied incorrectly.
  • Key belongs to another project.
  • Key was deleted or restricted.

Fix:

  • Generate a new key in Google AI Studio.
  • Paste it into Odoo and save.

Quota Exceeded

Cause:

  • Google AI Studio free-tier request-per-day or request-per-minute limit has been reached.

Fix:

  • Wait for quota reset.
  • Use another model with available quota.
  • Enable billing in Google Cloud.

Wrong Model ID

Cause:

  • Selected model is not available for the API key/project.
  • Custom model ID is misspelled.

Fix:

  • Select a known working model.
  • Check model availability in Google AI Studio.

Wrong API Base URL

Cause:

  • API base URL was changed incorrectly.

Fix:

  • Restore:

    https://generativelanguage.googleapis.com/v1beta
    

6. Developer Usage

Basic Chat Call

Use chat-style message dictionaries. The connector converts them to Gemini request format internally.

messages = [
    {
        'role': 'user',
        'content': 'Explain Odoo Sales in one short paragraph.',
    }
]

response = env['sm.gemini.connector.service'].call_ai_chat(
    messages,
    temperature=0.7,
    max_tokens=300,
)

Direct Gemini Call

response = env['sm.gemini.connector.service'].call_gemini_chat(
    messages,
    temperature=0.4,
    max_tokens=500,
)

System Prompt

The connector supports system messages.

messages = [
    {
        'role': 'system',
        'content': 'You are a concise Odoo assistant.',
    },
    {
        'role': 'user',
        'content': 'Summarize this customer note.',
    },
]

response = env['sm.gemini.connector.service'].call_ai_chat(messages)

Model Override

You can override the configured model for one call:

response = env['sm.gemini.connector.service'].call_ai_chat(
    messages,
    model='gemini-2.5-flash',
)

JSON Response Parsing

raw_response = env['sm.gemini.connector.service'].call_ai_chat(messages)
data = env['sm.gemini.connector.service'].parse_json_response(raw_response)

The parser handles:

  • Plain JSON.
  • Markdown json code fences.
  • Markdown generic code fences.
  • Text responses that contain a JSON object.

7. API Behavior

Endpoint

The connector calls:

POST {Gemini API Base URL}/models/{model}:generateContent

Default endpoint:

https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent

Headers

The request uses:

Content-Type: application/json
x-goog-api-key: <Gemini API Key>

Payload

The connector converts Odoo/chat-style messages to Gemini payload:

  • system -> systemInstruction
  • user -> Gemini user role
  • assistant -> Gemini model role

Generation Config

The connector sends:

  • temperature
  • maxOutputTokens
  • topP
  • topK

8. Usage Tracking

Gemini returns usage metadata in the response.

The connector reads:

  • promptTokenCount
  • candidatesTokenCount
  • totalTokenCount

It stores the total in:

sm_gemini_connector.total_tokens_used

Monthly Token Limit

The monthly limit is stored in:

sm_gemini_connector.monthly_token_limit

If the limit is 0, the connector treats it as unlimited.

If total usage reaches the configured limit, the connector stops requests and raises:

Gemini Connector monthly token limit reached.

Reset Counter

Use Reset Counter in Settings to reset usage to 0.


9. Security Notes

API Key Storage

The Gemini API key is stored in Odoo ir.config_parameter.

Recommendations:

  • Limit Settings access to trusted administrators.
  • Do not paste API keys into logs, chat messages, tickets, or screenshots.
  • Rotate keys if they are exposed.
  • Use Google Cloud restrictions where possible.

Error Sanitization

The connector sanitizes common API key patterns in error messages before showing them to users.

Still, administrators should avoid sharing full tracebacks publicly.


10. Troubleshooting

Test Connection Fails

Check:

  • API key is saved.
  • Model is available for the current project.
  • API base URL is correct.
  • Google AI Studio quota is available.
  • Odoo server can reach the internet.

Quota Error

If Google says quota is exceeded:

  • Check Google AI Studio Rate Limit page.
  • Try another Gemini model with available quota.
  • Wait for daily reset.
  • Enable billing if production usage is needed.

Module Does Not Appear in Settings

Check:

  • Module is installed.
  • Browser page is refreshed.
  • User has access to General Settings.
  • Odoo assets are refreshed if needed.

Command:

python3 ~/odoo/odoo-18/odoo-server \
   -c ~/odoo/conf/odoo.conf \
   -d your_database \
   -u sm_gemini_connector \
   --stop-after-init \
   --no-http

11. Technical Reference

Python Model

sm.gemini.connector.service

Important Methods

call_ai_chat(messages, temperature=0.7, max_tokens=1000, model=None)
call_gemini_chat(messages, temperature=0.7, max_tokens=1000, model=None)
test_gemini_connection()
parse_json_response(response)

Settings Fields

sm_gemini_connector_gemini_api_key
sm_gemini_connector_gemini_model
sm_gemini_connector_gemini_custom_model
sm_gemini_connector_gemini_api_base_url
sm_gemini_connector_request_timeout
sm_gemini_connector_tokens_used
sm_gemini_connector_monthly_token_limit

Compatibility

  • Tested on Odoo 18.0 Community & Enterprise.
  • Requires Odoo base and web.
  • Uses standard Odoo ORM, res.config.settings, and ir.config_parameter.
  • Uses Python requests library.

12. Support and Maintenance

Maintainer:

Steven Marp

License:

OPL-1

The module is intended as a shared Gemini foundation for future Odoo AI apps and customer-specific AI automation projects.

Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with