Skip to main content
Best for: building Valyu into your product / agents. Add real-time search to an OpenAI app via Valyu’s provider.
The OpenAIProvider exposes Valyu search as a tool through OpenAI’s Responses API, so your agents can pull real-time information from academic papers, news, financial data, and authoritative sources.

Paste into your AI assistant to wire Valyu search into an OpenAI app.

Open in Cursor

Installation

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

Free Credits

Get your API key with $10 free credits ($20 with a work email) from the Valyu Platform.

Basic Usage

The OpenAI provider handles the integration with the Responses API:

How it works

The OpenAIProvider handles tool registration, execution, and conversation flow for you. The model decides when to search; the provider runs the call and feeds results back.
This uses OpenAI’s Responses API (responses.create()), not Chat Completions.
The model 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: cite sources, use natural-language queries (not operators). See the Prompting Guide.

Additional Resources

OpenAI Responses API

Official OpenAI Responses API documentation

Valyu API Reference

Complete Valyu API documentation

Python SDK

Full Python SDK documentation

Get API Key

Sign up for $10 free credits ($20 with a work email)