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

# Quickstart

## Start using the Draftify API in seconds and integrate our powerful reasoning AI models into your applications.

***

The Draftify API allows you to easily integrate the smartest AI models available on our\
platform (such as `opus-4.8-level`, `opus 4.6-level`, `opus 4.7-level` `fable-5-level`, or `sonnet-4.6-level`) directly into\
your own software.

This quickstart guide will walk you through the initial setup and show you how to make\
your very first API request.

## Prerequisites

Before you begin, you must have:

* An active Draftify account (From Free plan) - A **Draftify API Key** (you can generate this in your Dashboard under *Settings > API*\
  *Keys*). - Node.js (v18+) or Python (v3.8+) installed, depending on your preferred development\
  environment. *Note: Your subscription plan (Free, Pro, or Scale) does not restrict API access, but it does determine your maximum context limit (e.g., up to 10,000,000 characters for Scale*\
  *users).*

## Get started

**1. Get your API Key**

Log into your Draftify account, navigate to the Dashboard, and create a new API key.\
You will need to include this key in the headers of your HTTP requests (`Authorization:      
      Bearer <TOKEN>`).

*Tip: Never share your API key publicly and always keep it secure in environment*\
*variables (e.g., in a `.env` file)!*

**2. Your first request (cURL)**

The fastest way to test the API is by making a request from your terminal. Send a\
simple message to the `sonnet-4.6-level` model:

```bash theme={null}
curl -X POST https://www.draftify.site/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_DRAFTIFY_API_KEY" \
  -d '{
    "model": "sonnet-4.6-level",
    "messages": [
      {
        "role": "user",
        "content": "Hello! Are you capable of reasoning?"
      }
    ]
  }'
```

**3. Use it in Python**

If you are working with Python, you can use the built-in `requests` library to send\
your prompts.

```python Python theme={null}
import requests
import os

api_key = os.getenv("DRAFTIFY_API_KEY")
url = "https://www.draftify.site/api/v1/chat/completions"

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

data = {
    "model": "fable-5-level",
    "messages": [{"role": "user", "content": "Write a short poem about programming.    
"}]
}

response = requests.post(url, headers=headers, json=data)
print(response.json()["choices"][0]["message"]["content"])
```

**4. Use it in Next.js / Node.js**

In a modern web application (like a Next.js API Route), here is how you can securely\
call the Draftify API from your backend using the native `fetch` API.

```javascript Next.js (App Router) theme={null}
// app/api/chat/route.js
import { NextResponse } from 'next/server';

export async function POST(request) {
  const body = await request.json();

  const response = await fetch('https://www.draftify.site/api/v1/chat/completions', {       
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.DRAFTIFY_API_KEY}`,
    },
    body: JSON.stringify({
      model: 'opus-4.8-level',
      messages: [{ role: 'user', content: body.prompt }]
    }),
  });

  const data = await response.json();
  return NextResponse.json({ result: data.choices[0].message.content });
}
```

## Next steps

Now that you have successfully integrated the API, you can explore more advanced features: - Read the [Models](https://draftify.site/docs/docs/models) documentation to find out which model is best suited\
for your specific use case. - Learn about [Streaming](https://draftify.site/docs/docs/streaming) to display AI responses to your users in real-\
time.

> [!TIP]
>
> Need help or got stuck? Join our developer community on Discord, or reach out to us\
> directly at [support@draftify.com](mailto:support@draftify.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.