Skip to main content
When making API calls to Keywords AI, you may encounter errors from two sources:
  1. Keywords AI errors - Errors thrown by the Keywords AI platform itself
  2. Provider errors - Errors from the underlying LLM provider (e.g., OpenAI, Anthropic)

Keywords AI Exceptions

When Keywords AI encounters an error, it will throw a KeywordsAIException. The error response will include details about what went wrong.

Common Keywords AI Error Responses

401 Unauthorized

400 Bad Request

422 Unprocessable Entity

429 Too Many Requests

500 Internal Server Error

Provider Exceptions

When an error originates from the underlying LLM provider (e.g., OpenAI, Anthropic), Keywords AI will surface the provider’s error response directly. The exception type will match the provider’s exception (e.g., OpenAIException for OpenAI errors).

OpenAI Errors

When using OpenAI models, you may encounter OpenAIException. The error response will be in OpenAI’s format:

Anthropic Errors

When using Anthropic models, you may encounter AnthropicException: