> ## Documentation Index
> Fetch the complete documentation index at: https://docs.valyu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript Quickstart

> Everything you need to use Valyu in TypeScript

The Valyu TypeScript SDK provides comprehensive access to all Valyu APIs, enabling you to build powerful AI applications with search, content extraction, answer generation, and deep research capabilities.

## Features

The SDK includes four core APIs:

* **[Search API](typescript-sdk/search)** - Advanced search across web and proprietary data sources
* **[Contents API](typescript-sdk/contents)** - Extract and process content from URLs with AI
* **[Answer API](typescript-sdk/answer)** - AI-powered answer generation with search integration
* **[DeepResearch API](typescript-sdk/deepresearch)** - Async deep research with comprehensive reports

## Installation

Install the Valyu TypeScript SDK using your preferred package manager:

<CodeGroup>
  ```bash npm theme={null}
  npm install valyu-js
  ```

  ```bash yarn theme={null}
  yarn add valyu-js
  ```

  ```bash pnpm theme={null}
  pnpm add valyu-js
  ```
</CodeGroup>

## Authentication

Get your API key from [Valyu Platform](https://platform.valyu.ai) (free \$10 credits included).

Set up authentication in one of two ways:

### Environment Variable (Recommended)

```bash theme={null}
export VALYU_API_KEY="your-api-key-here"
```

```typescript theme={null}
import { Valyu } from "valyu-js";

// Automatically uses VALYU_API_KEY from environment
const valyu = new Valyu();
```

### Direct API Key

```typescript theme={null}
import { Valyu } from "valyu-js";

const valyu = new Valyu("your-api-key-here");
```

## Quick Start

Here's a simple example to get you started with search:

```typescript theme={null}
import { Valyu } from "valyu-js";

const valyu = new Valyu();

// Basic search example
const searchResponse = await valyu.search(
  "What are the latest developments in quantum computing?"
);

console.log(`Found ${searchResponse.results.length} results`);
searchResponse.results.forEach(result => {
  console.log(`Title: ${result.title}`);
  console.log(`URL: ${result.url}`);
  console.log(`Content preview: ${result.content.substring(0, 200)}...`);
});
```

## Error Handling

The SDK includes built-in error handling and validation:

```typescript theme={null}
const response = await valyu.search("test query");

if (!response.success) {
  console.error("Search failed:", response.error);
  return;
}

// Process successful results
response.results.forEach(result => {
  // Handle each result
});
```

## Next Steps

Explore the detailed documentation for each API:

<CardGroup cols={2}>
  <Card title="Search API" icon="magnifying-glass" href="typescript-sdk/search">
    Advanced search across web and proprietary sources
  </Card>

  <Card title="Contents API" icon="book" href="typescript-sdk/contents">
    Extract and process web content with AI
  </Card>

  <Card title="Answer API" icon="messages" href="typescript-sdk/answer">
    Generate AI-powered answers with search
  </Card>

  <Card title="DeepResearch API" icon="flask" href="typescript-sdk/deepresearch">
    Async deep research with comprehensive reports
  </Card>
</CardGroup>

## Support

* **Discord**: [Join our community](https://discord.gg/umtmSsppRY)
* **GitHub**: [valyuAI/valyu-js](https://github.com/valyuAI/valyu-js)
* **Support**: [contact@valyu.ai](mailto:contact@valyu.ai)
