Skip to main content
Glama
gemini_api_client.ts1.19 kB
// Type definitions for Gemini API interactions // Configuration for text generation export interface GenerationConfig { temperature?: number; maxOutputTokens?: number; topK?: number; topP?: number; } // Part of a content message export interface Part { text?: string; functionCall?: { name: string; args: Record<string, any>; }; functionResponse?: { name: string; response: { result: any }; }; } // Content message (system, user, or model) export interface Content { role: string; parts: Part[]; } // Response from generateContent API call export interface GenerateContentResult { candidates?: { content: { parts: Part[]; role: string; }; }[]; } // Simple API client for Gemini export class GeminiApiClient { private apiKey: string; private baseUrl: string; private model: string; constructor(apiKey: string, model: string = 'gemini-2.0-flash') { this.apiKey = apiKey; this.model = model; this.baseUrl = 'https://generativelanguage.googleapis.com/v1beta'; } // Method to get API URL getApiUrl(): string { return `${this.baseUrl}/models/${this.model}:generateContent?key=${this.apiKey}`; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/IA-Entertainment-git-organization/gemini-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server