Skip to main content
Glama
groq.js1.12 kB
/** * src/ai-providers/groq.js * * Implementation for interacting with Groq models * using the Vercel AI SDK. */ import { createGroq } from '@ai-sdk/groq'; import { BaseAIProvider } from './base-provider.js'; export class GroqProvider extends BaseAIProvider { constructor() { super(); this.name = 'Groq'; } /** * Returns the environment variable name required for this provider's API key. * @returns {string} The environment variable name for the Groq API key */ getRequiredApiKeyName() { return 'GROQ_API_KEY'; } /** * Creates and returns a Groq client instance. * @param {object} params - Parameters for client initialization * @param {string} params.apiKey - Groq API key * @param {string} [params.baseURL] - Optional custom API endpoint * @returns {Function} Groq client function * @throws {Error} If API key is missing or initialization fails */ getClient(params) { try { const { apiKey, baseURL } = params; return createGroq({ apiKey, ...(baseURL && { baseURL }) }); } catch (error) { this.handleError('client initialization', error); } } }

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/eyaltoledano/claude-task-master'

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