How Drift works

Sign in, link a wallet, one key.

An account holds your balance, keys, listings and payouts. A linked wallet is where money comes in and goes out. The key is what your code calls — every model, at the price the book gives you.

1. Sign in

Sign up with an email and a six-digit code, or continue with Google. Everything you own on Drift hangs off that account: balance, API keys, listings and cash-outs.

2. Connect and prove your wallet

On the account page, connect a browser wallet on Robinhood Chain (4663), then sign the short message Drift shows. It is a signature, not a transaction — no gas, nothing moves. The signature proves the address is yours before anything is credited or paid out to it.

Connect wallet

3. Fund your balance

Account lists the tokens Drift accepts and the address to send them to. After sending, paste the transaction hash back. The gateway reads the transfer from chain, confirms it came from your linked wallet, and credits 1 USD of credits per 1 USD received. Nothing is credited until the transfer is verified.

4. Buy, sell, cash out

Buying fills the deepest discount in the book first, oldest listing first at the same level. Selling escrows the credits the moment you list them, and anything unfilled comes back when you cancel. Cash out from the sellers page: the payout is debited from your balance and settles to your linked wallet.

Open the sellers page

5. Get a key

Make a key on the account page. Keys look like sk-srp-…, are shown once, and can carry a per-key monthly spend cap so a client can never overrun your balance.

Open account

6. Send a request

The gateway speaks the OpenAI chat-completions format. Change the base URL and the key, keep the rest of your client.

curl
curl https://your-app.base44.app/api/v1/chat/completions \
  -H "Authorization: Bearer $DRIFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "messages": [
      { "role": "system", "content": "Be concise." },
      { "role": "user", "content": "Explain surplus credits in two sentences." }
    ]
  }'
response
{
  "id": "chatcmpl_9f2a1c4d8e6b",
  "object": "chat.completion",
  "created": 1772000000,
  "model": "anthropic/claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Surplus credits are..." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 42, "completion_tokens": 118, "total_tokens": 160 }
}

Request fields

FieldTypeNotes
modelstringCatalogue slug, e.g. openai/gpt-5-mini.
messagesarrayRoles system, user, assistant. Strings or text parts.
max_tokensnumberAccepted. The provider decides the final length.
streambooleanNot yet. Responses return as one JSON body.

How a request is billed

Cost is computed per request from the model's input and output price, with that model's discount applied, and debited from your balance the moment the answer returns. The response headers carry the numbers:

  • x-gateway-latency-ms — gateway time for the request
  • x-credit-cost-micros — what was debited (1e6 = $1)
  • x-list-cost-micros — what the same request costs at list price

Errors

401missing_key / invalid_keyNo key sent, or the key was revoked.
402insufficient_creditsBalance too low for this request. Buy credits and retry.
404unknown_modelThe model slug is not in the catalogue.
400bad_requestBody is not JSON, or `messages` is missing.
502upstream_errorThe provider failed. You are not charged for it.

Migrating from another gateway

Keep your client and change two environment variables:

OPENAI_BASE_URL=https://your-app.base44.app/api/v1
OPENAI_API_KEY=sk-srp-…