In this section we will cover how to set up and use the Anthropic provider with Flock to access Claude models. Before starting, you should have already followed the Getting Started guide.

Anthropic Provider Setup

To use the Anthropic provider, you need to get your API key from the Anthropic Console. Only two steps are required:
  • First, create a secret with your Anthropic API key. Optionally, you can specify an API version (defaults to 2023-06-01):
  • Next, create your Claude model in the model manager. Make sure that the name of the model is unique:
  • Now you can use Flock with the Anthropic provider:

Available Claude Models

Anthropic offers several Claude models with different capabilities and price points. See the Anthropic Models Documentation for the full list. All models are fully supported. The adapter automatically selects the appropriate API method based on model version.

Model Parameters

You can customize Claude’s behavior with model parameters:

Supported Parameters

Flock supports all parameters provided by the Anthropic Messages API. Common examples include:
  • temperature - Controls randomness (0.0 to 1.0)
  • max_tokens - Maximum response length (required by Anthropic, default: 4096)
  • system - System prompt for context and instructions
  • top_p - Nucleus sampling threshold
  • top_k - Limits token selection to top K options

System Prompts

Unlike other providers, Anthropic handles system prompts separately from the message history. You can set a system prompt in the model parameters:

Image Support

Claude models support image analysis. Images can be provided as:
  • URLshttp:// or https:// URLs are downloaded and converted to base64 automatically
  • File paths – Local files are read and converted to base64
  • Base64-encoded data – Used directly
URLs and file paths are resolved the same way as with OpenAI and Ollama.

Structured Output

Flock ensures structured JSON responses from all Claude models using a hybrid approach:
  • Claude 4.x models: Uses the native output_format API (preferred, guaranteed schema compliance)
  • Claude 3.x models: Falls back to tool_use for structured output (compatible with older models)
This hybrid approach ensures all Claude models work seamlessly with Flock, while using the optimal API for each model version.

Custom Schema (Claude 4.x only)

For Claude 4.x models, you can specify a custom JSON schema:
Note: Custom schemas require "additionalProperties": false for all objects.

Important: No Embedding Support

Anthropic does not provide an embeddings API. If you need embeddings for similarity search or RAG pipelines, use OpenAI or Ollama instead:
Attempting to use llm_embedding with an Anthropic model will result in a clear error message.

Rate Limits and Usage

Anthropic has rate limits based on your plan tier. Monitor your usage in the Anthropic Console. For high-volume workloads, use appropriate max_batch_size settings and consider setting a per-model rate_limit in Flock to throttle requests per minute (see Models Management).

API Version

The default API version is 2023-06-01. You can override this when creating a secret by passing the optional API_VERSION parameter. The adapter automatically includes the required anthropic-version header with all requests.