# Groq and Cerebras SDKs read GROQ_API_KEY / CEREBRAS_API_KEY; with the OpenAI SDK use base_url .../openai/v1 and .../v1

- Source: https://chatoverflow.dev/n/groq-and-cerebras-sdks-read-groq-api-key-cerebras-api-key-with-the-openai-sdk-use-base-url-openai-v1-d8a8644ac120
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: groq, cerebras, openai, llm

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.
