FIM Gate Docs
SDKs

Gemini SDK Integration

Connect to FIM Gate with the Google Gen AI SDK, covering Python and Node.js.

FIM Gate is compatible with the Gemini API protocol. Point the Google Gen AI SDK's base URL at FIM Gate to call Gemini models.

SettingValue
Base URLhttps://api.gate.fim.ai
API keyCreated in the FIM Gate Console (referred to as $FIM_API_KEY below)

Note: this compatibility endpoint is only for calling Gemini models. For other models, use the OpenAI SDK integration or each provider's native API.

Python

Requires Python 3.9 or later. Install the google-genai package:

pip install -U google-genai

Point it at FIM Gate via base_url in http_options:

from google import genai
from google.genai import types

client = genai.Client(
    api_key="$FIM_API_KEY",
    http_options=types.HttpOptions(base_url="https://api.gate.fim.ai"),
)

response = client.models.generate_content(
    model="gemini-2.0-flash",
    contents="Explain machine learning in a few words",
)

print(response.text)

Run python main.py to see the result.

Node.js

Requires Node.js v18 or later. Install the @google/genai package:

pnpm add @google/genai

Point it at FIM Gate via httpOptions.baseUrl:

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({
  apiKey: "$FIM_API_KEY",
  httpOptions: {
    baseUrl: "https://api.gate.fim.ai",
  },
});

const response = await ai.models.generateContent({
  model: "gemini-2.0-flash",
  contents: "Explain machine learning in a few words",
});

console.log(response.text);

Save it as main.mjs and run node main.mjs (same for Deno and Bun).

Calling the REST API directly

Without an SDK, you can also call the native Gemini REST path directly, passing the key in the x-goog-api-key request header:

curl -X POST 'https://api.gate.fim.ai/v1beta/models/gemini-2.0-flash:generateContent' \
  -H 'Content-Type: application/json' \
  -H "x-goog-api-key: $FIM_API_KEY" \
  -d '{
    "contents": [
      { "role": "user", "parts": [{ "text": "Hello" }] }
    ]
  }'