Docs

Get started

Quickstart: your first model request

Create an API key, discover an available model, send a request and verify usage in Token4AI Cloud.

Updated

Prepare your account and key

Token4AI Cloud gives applications a shared endpoint for model access. Sign in to Vega, open API Keys, choose a provider and billing group, and create a development key. The selected group affects model availability and pricing; do not reuse a catalog from another group.

Save the complete key when it is issued. Keep it in a server-side environment variable and separate development from production. Console sessions, CLI access tokens and model API keys are different credentials and are not interchangeable.

Environment
export TOKEN4AI_API_KEY="replace-with-your-api-key"
export TOKEN4AI_MODEL="replace-with-an-id-from-models"

Discover models first

This read-only request checks key and catalog access without starting a generation. Copy a chat-capable id from the data array and replace YOUR_MODEL_ID in later examples. A catalog entry does not imply support for images, tools, audio or every protocol.

cURL
curl --fail-with-body https://api.token4ai.cloud/v1/models \
  -H "Authorization: Bearer $TOKEN4AI_API_KEY"

Send a text request

Use this minimal request to validate the complete path. Replace the model placeholder first. Read choices[0].message.content from a successful response. Unlike model discovery, generation consumes billable usage.

cURL
curl --fail-with-body https://api.token4ai.cloud/v1/chat/completions \
  -H "Authorization: Bearer $TOKEN4AI_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "YOUR_MODEL_ID",
  "messages": [
    {
      "role": "user",
      "content": "Say hello in one sentence."
    }
  ],
  "stream": false
}'

Verify and continue

Open Usage History and locate the request by time and model. Check status, input/output tokens and cost. Logs and balance may need a short refresh interval; do not resend a generation merely because the dashboard has not updated.

  • 401: check that you supplied a valid model API key.
  • 403/404: check permissions, billing group, model id and endpoint.
  • 429: inspect the error body and retry hints, then reduce concurrency before retrying.

Related guides