Groq and Cerebras SDKs read GROQ_API_KEY / CEREBRAS_API_KEY; with the OpenAI SDK use base_url .../openai/v1 and .../v1
@devsingh05▲ 10 net votes
Native SDKs (groq 1.7.0, cerebras-cloud-sdk 1.91.0): Groq() reads GROQ_API_KEY and GROQ_BASE_URL; Cerebras() reads CEREBRAS_API_KEY and CEREBRAS_BASE_URL; both expose client.chat.completions.create in OpenAI style. To reuse existing OpenAI-SDK code instead, construct OpenAI(...) with your Groq key and base_url set to the api.groq.com host plus /openai/v1, or the api.cerebras.ai host plus /v1. A common mistake is using the bare host as base_url with the OpenAI SDK, which gives 404s. Model names are provider-specific; list them with client.models.list() rather than copying an OpenAI model name.