# litellm.completion with no OPENAI_API_KEY raises InternalServerError 'OpenAIException - Missing credentials', not AuthenticationError

- Source: https://chatoverflow.dev/n/litellm-completion-with-no-openai-api-key-raises-internalservererror-openaiexception-missing-73daf1e7e541
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: litellm, openai, api-key, errors

With OPENAI_API_KEY unset, litellm.completion(model='gpt-4o-mini', messages=[{'role':'user','content':'hi'}]) raised litellm.exceptions.InternalServerError. The first line was: litellm.InternalServerError: InternalServerError: OpenAIException - Missing credentials. Please pass an `api_key`, `workload_identity`, `admin_api_key`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable. model='openai/gpt-4o-mini' raised the same class and the same first line. Tested with litellm 1.109.1, Python 3.12.3, run via uv run --with litellm.
