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

# SDK Quickstart

> Get started with the Orchata TypeScript SDK in minutes

The Orchata TypeScript SDK provides a type-safe, universal client for Node.js, Deno, Bun, and browsers. Get started in under 5 minutes.

## Installation

Install the SDK using your preferred package manager:

<Tabs>
  <Tab title="npm">
    ```bash theme={null}
    npm install @orchata-ai/sdk
    ```
  </Tab>

  <Tab title="pnpm">
    ```bash theme={null}
    pnpm add @orchata-ai/sdk
    ```
  </Tab>

  <Tab title="yarn">
    ```bash theme={null}
    yarn add @orchata-ai/sdk
    ```
  </Tab>

  <Tab title="bun">
    ```bash theme={null}
    bun add @orchata-ai/sdk
    ```
  </Tab>
</Tabs>

## Get Your API Key

<Steps>
  <Step title="Navigate to Dashboard">
    Go to [app.orchata.ai](https://app.orchata.ai) and sign in.
  </Step>

  <Step title="Create API Key">
    Navigate to **Settings** → **API Keys** and click **Create API Key**.
  </Step>

  <Step title="Copy Your Key">
    Copy the API key immediately - you won't be able to see it again after closing the dialog.

    <Warning>
      Store your API key securely. Never commit it to version control.
    </Warning>
  </Step>
</Steps>

## Basic Setup

Create a client instance with your API key:

```typescript theme={null}
import { Orchata } from '@orchata-ai/sdk';

const client = new Orchata({
  apiKey: 'oai_your_api_key' // Get one at https://app.orchata.ai
});
```

## Your First Query

Query your knowledge base using semantic search:

```typescript theme={null}
const { results } = await client.query({
  spaceIds: 'space_123', // Replace with your space ID
  query: 'How do I reset my password?'
});

// Access the first result
console.log(results[0].chunk.content);
console.log(`Similarity score: ${results[0].similarity}`);
```

<ResponseExample>
  ```json Response theme={null}
  {
    "results": [
      {
        "similarity": 0.92,
        "chunk": {
          "content": "To reset your password, go to Settings → Security → Reset Password...",
          "metadata": {}
        },
        "document": {
          "id": "doc_xyz789",
          "filename": "user-guide.md",
          "spaceId": "space_123"
        },
        "space": {
          "id": "space_123",
          "name": "Product Documentation"
        }
      }
    ]
  }
  ```
</ResponseExample>

## Features

<CardGroup cols={2}>
  <Card title="Type-Safe" icon="shield-check">
    Full TypeScript support with auto-completion and type checking.
  </Card>

  <Card title="Universal" icon="globe">
    Works with Node.js 18+, Deno, Bun, and modern browsers.
  </Card>

  <Card title="Zero Dependencies" icon="package">
    Uses native `fetch` - no heavy dependencies.
  </Card>

  <Card title="AI-Ready" icon="sparkles">
    Built-in tools for Vercel AI SDK v5+ integration.
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Usage Guide" icon="book" href="/sdk/usage">
    Learn about Spaces, Documents, and Queries APIs.
  </Card>

  <Card title="AI Integration" icon="sparkles" href="/sdk/ai-integration">
    Integrate with Vercel AI SDK for AI-powered applications.
  </Card>

  <Card title="Error Handling" icon="triangle-alert" href="/sdk/errors">
    Handle errors gracefully with typed error classes.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore the REST API documentation.
  </Card>
</CardGroup>
