---
title: Quickstart
description: Get up and running with Agnic in 5 minutes
---

# Quickstart

Get started with Agnic and make your first X402 request in under 5 minutes.

## Step 1: Create an Account

Sign up at [app.agnic.ai](https://app.agnic.ai) with your email. We'll automatically create an embedded wallet for you with $5 in free credits.

## Step 2: Generate API Token

1. Go to your **Dashboard**
2. Click **Connect App**
3. Set your spending limits:
   - **Per transaction**: Maximum amount per API call
   - **Daily limit**: Total spend allowed per day
   - **Monthly limit**: Total spend allowed per month
4. Click **Generate Token**
5. Copy your token: `agnic_tok_sk_live_...`

<Callout type="warn">
  Save your token securely! It's only shown once.
</Callout>

## Step 3: Make Your First Request

### Using the AI Gateway

The easiest way to start is with our OpenAI-compatible AI Gateway:

```bash
curl https://api.agnic.ai/v1/chat/completions \
  -H "X-Agnic-Token: agnic_tok_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o-mini",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

### Using the X402 Fetch Proxy

For any X402-enabled API, use our transparent proxy:

```bash
curl -X POST "https://api.agnic.ai/api/x402/fetch?url=https://api.example.com/data" \
  -H "X-Agnic-Token: agnic_tok_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Generate a summary"}'
```

<Callout type="info">
  X402 Payments is an opt-in feature. If you haven't already, enable it under **Settings → Credits → Enable X402 Payments** in the dashboard. It's a one-time step.
</Callout>

## Step 4: Check Your Balance

```bash
curl https://api.agnic.ai/api/balance \
  -H "X-Agnic-Token: agnic_tok_YOUR_TOKEN"
```

Response:
```json
{
  "usdcBalance": "4.950000",
  "address": "0x1234...",
  "hasWallet": true,
  "network": "base-sepolia"
}
```

## Using with OpenAI SDK

### Python

```python
from openai import OpenAI

client = OpenAI(
    api_key="agnic_tok_YOUR_TOKEN",
    base_url="https://api.agnic.ai/v1"
)

response = client.chat.completions.create(
    model="openai/gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)
```

### JavaScript/TypeScript

```javascript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'agnic_tok_YOUR_TOKEN',
  baseURL: 'https://api.agnic.ai/v1'
});

const response = await client.chat.completions.create({
  model: 'openai/gpt-4o-mini',
  messages: [{ role: 'user', content: 'Hello!' }]
});

console.log(response.choices[0].message.content);
```

## Alternative: Use the CLI

If you prefer the command line, install the `agnic` CLI:

```bash
# Login with email
npx agnic auth login your@email.com
npx agnic auth verify <flowId> <otp-from-email>

# Check balance
npx agnic balance

# Make an x402 request
npx agnic x402 pay https://api.example.com/data
```

See the [CLI reference](/docs/agnicpay-features/cli) for all commands.

## Next Steps

<Cards>
  <Card title="X402 Core Concepts" href="/docs/x402/core-concepts" />
  <Card title="CLI Tool" href="/docs/agnicpay-features/cli" />
  <Card title="OAuth2 Integration" href="/docs/authentication/oauth2" />
  <Card title="API Reference" href="/docs/api-reference" />
</Cards>
