Getting started

Quickstart

Sign in, create an API key, and get your first calibrated answer from Drex.

In this tutorial we sign in, create an API key, and ask Drex two questions about one support message. By the end you have a working call in curl, TypeScript, Python or the nace CLI and know how to read the answer.

Sign in and claim your balance

Open console.nace.ai/login. Enter your email, click Continue with email, and enter the code from your inbox.

A new account gets $5.00 of signup balance once a person is behind it: sign in with Google, sign in with a GitHub account at least 30 days old, or verify a card on the billing page. The card is not charged, pay as you go stays off, and each card unlocks one signup bonus. The balance expires 3 months after the account is created, and each person gets it once. The rest of the price sheet is on Pricing.

Create an API key

In the dashboard, open API Keys and click Create key. Name the key after the app or environment that will use it, then click Create key again.

The dialog shows the full key once. Copy it now. If you lose it, revoke it and create a new one.

Now export it in your shell:

export NACE_API_KEY="nace_sk_..."

Ask your first question

We send one line of customer text as state and one noul (yes or no) question about it.

curl https://console.nace.ai/v1/systemone \
  -H "Authorization: Bearer $NACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "drex-latest",
    "state": "Help! My payouts have been failing for 3 days.",
    "questions": {
      "is_urgent": { "type": "noul", "instructions": "Does this convey urgency?" }
    }
  }'

The curl call prints the full response. The TypeScript and Python calls print only the noul value, and the CLI prints one line per answer (add --json for the full response). The SDKs and the CLI read the key from NACE_API_KEY; every option they take is on the Python, TypeScript and CLI pages. The responses below are illustrative, not measured Drex 2.0 outputs. Actual probabilities, usage and timings vary.

Response
{
  "model": "drex-v2.0",
  "answers": {
    "is_urgent": { "type": "noul", "noul": 0.8401, "confidence": 0.8401 }
  },
  "usage": { "input_tokens": 26, "output_tokens": 24 },
  "evaluation_time_ms": 6.8,
  "request_id": "req_9d4e1b2c7a3f4e0d8b6c5a4f3e2d1c0b"
}

noul is the probability of yes, from 0 to 1. Here Drex puts 84% on the message being urgent. You choose the threshold. Route on noul > 0.5 for a plain yes or no, or on a higher cutoff when a false yes is expensive.

Add a choice question to the same call

Drex answers many questions about one state in one call. We add a choice question with three labels. The description next to each label tells Drex what the label means.

curl https://console.nace.ai/v1/systemone \
  -H "Authorization: Bearer $NACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "drex-latest",
    "state": "Help! My payouts have been failing for 3 days.",
    "questions": {
      "is_urgent": {
        "type": "noul",
        "instructions": "Does this convey urgency?"
      },
      "team": {
        "type": "choice",
        "instructions": "Which team should handle this?",
        "criteria": {
          "payments": "Payouts, charges, or refunds",
          "support": "General questions and how-to",
          "engineering": "Bugs and outages"
        }
      }
    }
  }'

Question types and options are on the Python, TypeScript and CLI pages.

The answers object now has two entries:

Response
{
  "model": "drex-v2.0",
  "answers": {
    "is_urgent": { "type": "noul", "noul": 0.8383, "confidence": 0.8383 },
    "team": {
      "type": "choice",
      "choice": "payments",
      "confidence": 0.884,
      "probabilities": {
        "payments": 0.9227,
        "support": 0.0296,
        "engineering": 0.0477
      }
    }
  },
  "usage": { "input_tokens": 63, "output_tokens": 86 },
  "evaluation_time_ms": 85.9,
  "request_id": "req_5b7a9c1e3d2f4a6b8c0d1e2f3a4b5c6d"
}

choice is the label with the highest probability. probabilities has one entry per label you defined, so you can see how far behind the other labels were before you act.

Next steps

You have a working call. The guides below cover the parts a real integration needs.

On this page