Skip to main content
Glama
google-provider.ts1.06 kB
import { httpClient, HttpMethod } from '@activepieces/pieces-common' import { AIProviderModel, AIProviderModelType, GoogleProviderConfig } from '@activepieces/shared' import { AIProviderStrategy } from './ai-provider' export const googleProvider: AIProviderStrategy<GoogleProviderConfig> = { name: 'Google', async listModels(config: GoogleProviderConfig): Promise<AIProviderModel[]> { const res = await httpClient.sendRequest<{ models: GoogleModel[] }>({ url: 'https://generativelanguage.googleapis.com/v1beta/models?pageSize=1000', method: HttpMethod.GET, headers: { 'x-goog-api-key': config.apiKey, 'Content-Type': 'application/json', }, }) return res.body.models.map((model: GoogleModel) => ({ id: model.name, name: model.displayName, type: model.name.includes('image') ? AIProviderModelType.IMAGE : AIProviderModelType.TEXT, })) }, } type GoogleModel = { name: string displayName: string }

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/activepieces/activepieces'

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