MLXDocs
Compute API · Pilot

Quickstart

Markdown
Pilot · not generally available yet

A key, some API credit and your first request, in a few minutes. You need an MLX Wallet with some USDC.

  1. Sign in to the console

    Open the console and sign in with your wallet's passkey or recovery phrase. It's the same MLX Wallet you use at wallet.mlx.app.

  2. Add API credit

    Choose Add credit and an amount (at least 1 USDC, at most 1,000 USDC in the pilot). Your wallet signs an api_fund transaction that moves the USDC into api.mlx, where it's held for your requests. $0.02 per million tokens means 1 USDC covers about 50 million tokens.

  3. Create a key

    Choose Create key and copy the key it shows. It starts with sk-mlx- and is shown only once: the network keeps only its hash.

  4. Send a request

    Point any OpenAI client at https://api.mlx.app/v1 and send a chat completion.

curl https://api.mlx.app/v1/chat/completions \
  -H "Authorization: Bearer $MLX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen2.5-0.5b-instruct",
    "messages": [{"role": "user", "content": "Classify the sentiment of: The battery lasts all day. Answer positive, negative or neutral."}],
    "max_tokens": 8
  }'

The reply is OpenAI's, with one extra object:

json
{
  "id": "chatcmpl-5f1c0a9e3b2d47a1c8",
  "object": "chat.completion",
  "model": "qwen2.5-0.5b-instruct",
  "choices": [{ "index": 0, "message": { "role": "assistant", "content": "positive" }, "finish_reason": "stop" }],
  "usage": { "prompt_tokens": 41, "completion_tokens": 2, "total_tokens": 43 },
  "mlx": { "verified": true, "macs": 2, "gpu_group": "m5", "cost_usd": 0.00000086, "ms": 2140 }
}

mlx.verified: true means two Macs of different wallets gave exactly this answer. Check your credit and recent requests in the console, or with GET /v1/account and your key.