Skip to content

Exa

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on the official Exa Public API v2 OpenAPI specification using AutoSDK
  • Full generated coverage for Exa Search, Contents, Answer, Agent, Research, Monitors, Websets, Webhooks, Events, Imports, and team endpoints published in the v2 spec
  • Same day update to support new features
  • Updated and supported automatically if there are no breaking changes
  • All modern .NET features - nullability, trimming, NativeAOT, etc.
  • Supports .NET 10

Usage

1
2
3
using Exa;

using var client = new ExaClient(apiKey);

CLI

1
2
dotnet tool install --global Exa.CLI --prerelease
exa api --help

Shows how to search the web using Exa's AI-powered search.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
using var client = new ExaClient(apiKey);

// Search the web for relevant results using a natural language query.
var response = await client.SearchAsync(
    new AllOf<SearchRequest2, CommonRequest>(
        value1: new SearchRequest2
        {
            Query = "Latest developments in LLM capabilities",
        },
        value2: new CommonRequest { NumResults = 5 }));

var results = response.Results;
Console.WriteLine($"Found {results!.Count} results");

foreach (var result in results)
{
    Console.WriteLine($"  - {result.Result?.Title}: {result.Result?.Url}");
}

Get Contents

Shows how to retrieve page contents for specific URLs using Exa.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
using var client = new ExaClient(apiKey);

// Retrieve the text content of specific web pages by URL.
var response = await client.GetContentsAsync(
    new AllOf<GetContentsRequest2, ContentsRequest>(
        value1: new GetContentsRequest2 { Urls = ["https://exa.ai"] },
        value2: new ContentsRequest { Text = true }));

Console.WriteLine($"Retrieved contents for {response.Results!.Count} URL(s)");

foreach (var result in response.Results)
{
    var text = result.ResultWithContentVariant2?.Text;
    Console.WriteLine($"  - {result.Result?.Url}: {text?[..Math.Min(text.Length, 100)]}...");
}

Find Similar

Shows how to find pages similar to a given URL using Exa.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
using var client = new ExaClient(apiKey);

        // Find pages similar to a given URL. This is useful for discovering
        // related content, competitor analysis, or expanding a research corpus.
#pragma warning disable CS0618 // findSimilar is deprecated by Exa but kept for complete API coverage.
        var response = await client.FindSimilarAsync(
            new AllOf<FindSimilarRequest2, CommonRequest>(
                value1: new FindSimilarRequest2
                {
                    Url = "https://arxiv.org/abs/2307.06435",
                },
                value2: new CommonRequest { NumResults = 3 }));
#pragma warning restore CS0618

        Console.WriteLine($"Found {response.Results!.Count} similar pages");

        foreach (var result in response.Results)
        {
            Console.WriteLine($"  - {result.Result?.Title}: {result.Result?.Url}");
        }

Search Tool

Shows how to use Exa as an AIFunction tool with any IChatClient.

1
2
3
4
using var client = new ExaClient(apiKey);

// Create a search tool from the Exa client for use with any IChatClient.
var tool = client.AsSearchTool(numResults: 3);

Answer Tool

Shows how to use Exa's answer endpoint as an AIFunction tool with any IChatClient.

1
2
3
4
using var client = new ExaClient(apiKey);

// Create an answer tool from the Exa client for RAG-style question answering.
var tool = client.AsAnswerTool();

Ecosystem maintenance

This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.

Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.

Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.

Support

Priority place for bugs: https://github.com/tryAGI/Exa/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Exa/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.