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

# Quickstart

> Start using Orynt in minutes — connect, make your first AI request, and handle pay-per-request flow with x402 + PayAI.

## Step 1: Install SDK

```bash theme={null}
npm add @orynt/ai-x402
```

Set your wallet private key in `.env`:

```bash theme={null}
PRIVATE_KEY=<your_wallet_private_key>
```

***

## Step 2: Initialize SDK

```javascript theme={null}
import { Orynt } from "@orynt/ai-x402";

const ai = new Orynt({
  baseUrl: "https://api.oryntai.xyz/api/v1",
  network: "solana-devnet",
});
```

***

## Step 3: Chat Example

```javascript theme={null}
await ai.chat({
  model: "gpt-4.1",
  messages: [{ role: "user", content: "Hello" }],
});

await ai.chat({
  model: "gpt-4.1",
  input: "Explain the x402 in one sentence.",
});

await ai.chat({
  model: "gpt-4.1",
  prompt: "Explain the x402 in one sentence.",
});
```

***

## Step 3: Image Generation

```javascript theme={null}
await ai.generateImage({
  model: "dall-e-3",
  prompt: "A futuristic city skyline at sunset",
  n: 1,
  width: 1024,
  height: 1024,
});
```

***

## Step 3: Text-to-Speech

```javascript theme={null}
await ai.textToSpeech({
  model: "gpt-4o-mini-tts",
  text: "Hello, welcome to X402 AI service.",
  voice: "alloy",
  format: "mp3",
});
```

***

## Step 4: Supported Networks

* base
* base-sepolia
* solana
* solana-devnet
* polygon
* polygon-amoy

Specify network via `network` in SDK, or `X-Network` in REST requests.

***

## Step 5: Payment Flow

* Requests handle **x402 micropayments** via PayAI
* If payment is required, the SDK generates a signed payload
* Request is automatically retried after payment
* Failed requests refund your token automatically

For REST requests, include `X-PAYMENT` header with the signed proof.

***

## Step 6: Next Steps

* Explore the [API Reference](https://api.oryntai.xyz/api/v1/docs)
* Try other models: `gradient-stratos`, `whisper-1`, etc.
* Generate embeddings, text-to-speech, or image outputs seamlessly

Orynt abstracts provider logic — just change `model` and `network` to switch AI backends.
