Quickstart

DrAI API Quickstart

Make your first request to the DrAI API in 5 minutes — create an account, grab a key, and call gpt-5-mini with curl, Python or JavaScript.

Updated Aug 16, 2026 · 5-minute read
  1. Create your account & get an API key

    Sign in to the DrAI dashboard with your email. Open API Keys and click Create key. Copy the key — it is shown only once.

    Keep it secret. Your key grants access to your subscription. Store it in an environment variable or secret manager, and never embed it in frontend code.
  2. Send your first request with curl

    Open a terminal and run:

    curl https://api.dr-ai.top/v1/chat/completions \
      -H "Authorization: Bearer $DRAI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "gpt-5-mini",
        "messages": [
          {"role": "system", "content": "You are a concise assistant."},
          {"role": "user", "content": "Say hello in one sentence."}
        ],
        "max_tokens": 200
      }'

    You should get a JSON response back in a second or two:

    {
      "id": "chatcmpl-9xK2mQ7r...",
      "object": "chat.completion",
      "model": "gpt-5-mini",
      "choices": [{
        "index": 0,
        "message": {
          "role": "assistant",
          "content": "Hello! I'm here to help."
        },
        "finish_reason": "stop"
      }],
      "usage": {"prompt_tokens": 24, "completion_tokens": 9, "total_tokens": 33}
    }

    That is your first AI response. 🎉 Every other endpoint works the same way — see the API Reference.

  3. Python SDK

    The official openai package works unchanged — only the base_url changes.

    pip install openai
    from openai import OpenAI
    
    client = OpenAI(
        api_key="sk-your-api-key",
        base_url="https://api.dr-ai.top/v1",
    )
    
    resp = client.chat.completions.create(
        model="gpt-5-mini",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "What is 12 * 12?"},
        ],
        temperature=0.7,
    )
    print(resp.choices[0].message.content)

    Use env-style configuration in production: client = OpenAI(base_url="https://api.dr-ai.top/v1") with OPENAI_API_KEY exported — the SDK reads it automatically.

  4. JavaScript / Node.js

    The same one-line change applies to the official Node SDK:

    npm install openai
    import OpenAI from "openai";
    
    const client = new OpenAI({
      apiKey: "sk-your-api-key",
      baseURL: "https://api.dr-ai.top/v1",
    });
    
    const resp = await client.chat.completions.create({
      model: "gpt-5-mini",
      messages: [{ role: "user", content: "Hello from Node.js!" }],
    });
    console.log(resp.choices[0].message.content);

    Streaming is just as easy: add stream: true and iterate for await (const chunk of resp).

  5. Next steps

Frequently asked questions

The answers developers ask most on day one.

What base URL should I use?

Use https://api.dr-ai.top/v1 for all requests. The API is OpenAI-compatible, so any OpenAI SDK works when pointed at this base URL.

How do I get an API key?

Sign in at ai.dr-ai.top, open the dashboard and create a key under API Keys. Keys start with sk- and are shown once; store them server-side.

Which model should I start with?

gpt-5-mini is the fastest and cheapest default ($0.15 per 1M input tokens). Switch to gpt-5 or claude-opus-4 for harder reasoning tasks.

Does the API support streaming?

Yes. Set stream: true to receive server-sent events (SSE). See the streaming section in the API Reference.

How is billing handled?

DrAI uses a flat monthly subscription — not per-token metering. One plan covers all 18+ models. See pricing for details.

Do you have rate limits?

Subscriptions include generous rate limits. If you exceed them you will receive a 429 response with a Retry-After header; see the error reference.

Ready to build?

Your free account takes 30 seconds to create. One key unlocks all 18+ models.

Get Started — free Browse the API Reference
🌐 English