This integration is for the Keywords AI gateway.
This is only a pass-through integration. So with this integration, some features are not available.
Default max_tokens: Anthropic requests sent through Keywords AI have a default of 4096 max_tokens. Make sure to explicitly set
max_tokens
in your requests if you need a different value.Pros and Cons
Pros
- Easy Setup: Only 2 lines of code to integrate.
- Use Claude’s
Thinking
Feature: You can use theThinking
feature fromClaude 3.7 Sonnet
or Claude 4 models.
Cons
- No Direct Prompt Access: You can’t fetch prompts stored in Keywords AI directly. You’ll need to use the Prompts API instead.
- Limited Gateway Features: You can’t use features like fallbacks or load balancing.
Integration examples
Extra Headers
You can pass additional headers to be sent with your LLM requests using theextra_headers
parameter. This is useful for sending custom headers required by specific models or configurations.
Extra Headers: The
extra_headers
parameter allows you to pass additional headers that will be sent with your LLM request. This is particularly useful for accessing beta features like Claude Sonnet 4’s 1M token context window using the anthropic-beta: context-1m-2025-08-07
header.Keywords AI parameters
To use Keywords AI parameters, you can pass them in themetadata
parameter. In the above example, customer_identifier
is a Keywords AI parameter. These parameters will take precedence over the Anthropic parameters if they are conflicting.