Skip to main content
Add Valyu Search to a Claude application with AnthropicProvider. Your application runs the model and tool loop; Valyu returns content and source URLs. To use Valyu inside the Claude chat app, connect via MCP.

Installation

Install the Valyu and Anthropic packages:
Set your API keys as environment variables:

Basic usage

The Anthropic provider handles the integration:
This example performs one round of search and then asks the model to write a response. For an agent that can search repeatedly, add a bounded tool loop and handle tool errors explicitly. Model-provider charges are separate from Valyu usage.

How it works

The AnthropicProvider handles tool registration, execution, and conversation flow for you - no manual function definitions or tool-calling logic. Claude decides when to search; the provider runs the call and feeds results back into the conversation.
Claude chooses these per query based on context:
  • max_num_results - 1-20 for standard keys, up to 100 with a special API key
  • included_sources / excluded_sources - target or exclude datasets
  • category - guide search to a topic
  • start_date / end_date - time-bounded searches
  • relevance_threshold - filter by relevance (0-1)
Steer behaviour with a system prompt. Tell Claude to cite sources and to use natural-language queries, not search operators. See the Prompting Guide.

Additional resources

Anthropic API Docs

Official Anthropic Claude documentation

Valyu API Reference

Complete Valyu API documentation

Python SDK

Full Python SDK documentation

Get API Key

Get 2,000 free credits a month with a work email (1,000 with a personal email; add a card after your first month to keep them coming)