AI Engine — GeminiAI provider · Google

Run Google Gemini models in Melis

The Gemini provider implements the AI engine’s contract for Google’s generateContent API — selected automatically when a model’s company is Google. Add a Gemini model, store the key, and point an agent at it.

Live demo
provider — Google Gemini
// Use Gemini:
// 1. create a model whose company is Google
// 2. model id like 'gemini-…', store the API key
// 3. point an agent / instance at it
// The engine routes here by company name —
// every chat then goes through Gemini.
generateContentfunctionCall parts
File APIuploads by URI

Package

melis-ai-engine-gemini

Role

AI provider

Vendor

Google

API

generateContent

Message key

contents

Tables

None — stateless

Overview

How Melis talks to Gemini

MelisAIEngineModelGeminiService extends the engine contract and POSTs to Google’s generateContent API — with the API key passed as a URL query parameter. It builds parts: text, fileData (a File API URI) and inlineData (base64).

It renames the engine’s tool schema (input_schema → parameters), parses functionCall parts (positional, with no id — unlike Claude), dispatches each tool, and continues until done. The default file mode is the Gemini File API.

Key features

What the provider does

The Gemini-specific wiring — transport, parts, tools and tokens — behind the engine’s common contract.

generateContent API

Talks to Google’s endpoint; the API key is a URL query parameter.

Parts & File API

text, fileData (File API URI) and inlineData (base64) parts; uploads via the File API by default.

Function calling

Renames tools to Gemini’s parameters shape; AUTO function-calling mode.

Tool dispatch & continuation

Parses functionCall parts, dispatches (MCP / built-in), continues until done.

Token handling

Reads usageMetadata (prompt / candidates / total tokens).

url_context fallback

With no tools, falls back to a url_context tool.

See it in action

Engine tools mapped to Gemini

The same contract every provider implements — here translated to Gemini’s generateContent shape.

provider — tool mapping
class MelisAIEngineModelGeminiService extends MelisAIEngineModelService {
    public function getMessageKey(): string { return 'contents'; }
    // addToolsToPayload(): input_schema → parameters, mode AUTO
    // sendCustomAI(): parse functionCall → dispatch → loop until done
}
AUTOfunction calling
Mapping

Engine tools → Gemini shape

Engine tools use input_schema; the provider renames it to parameters and nests it under functionDeclarations. Gemini tool calls are positional — no id, unlike Claude.

  • Message key: contents
  • Roles: user / model
  • functionCall has no id (positional)

For developers

How it's wired

Auth via URL

The API key is a query parameter (mind logs and proxies); a long timeout for tool loops.

Stateless

No tables — conversation state lives in the engine.

Default file mode: File API

Uploads files and references them by URI (Claude defaults to embed).

// Selected when the model's company contains 'Google'.
// Returns tool results as {functionResponse:{name, response:{result}}}
// and continues until no more functionCall parts remain.

Part of Melis Platform

Explore the rest of the platform

The Gemini provider is one engine implementation — here are the modules around it.

Add Gemini to your platform

See agentic AI running on Google Gemini.