Developers / Docs / Quickstart

Quickstart

Sign in, copy your key, send a request. ARK Cloud speaks the OpenAI API, so the official SDKs work as they are.

1. Get an API key

  1. Open the ARK Cloud portal and choose Continue with Google. Your account is created on first sign-in and comes with free starter credits.
  2. Your API key is on the dashboard. Copy it.
  3. When you need more, buy prepaid credits on the portal's Pricing page. One million credits cost $1.

Keep the key out of your code. Put it in an environment variable:

export ARK_API_KEY="paste-your-key-here"

2. Install an SDK

Any OpenAI client works. These examples use the official ones.

pip install openai

3. Send your first request

Point the client at ARK's base URL and pick a model from the model list.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.ark-labs.cloud/api/v1",
    api_key=os.environ["ARK_API_KEY"],
)

response = client.chat.completions.create(
    model="arklabsai/Qwen3.6-35B-A3B",
    messages=[
        {"role": "system", "content": "Answer in one sentence."},
        {"role": "user", "content": "What is data residency?"},
    ],
)
print(response.choices[0].message.content)

The response has the familiar shape. ARK Cloud adds the credits the request cost and your remaining balance to usage:

Response
{
  "id": "chatcmpl-1f6a0c1e-5c55-4a43-9a0e-7f2d8e0c4b91",
  "object": "chat.completion",
  "created": 1792345678,
  "model": "arklabsai/Qwen3.6-35B-A3B",
  "service_tier": "default",
  "system_fingerprint": null,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Data residency means your data is stored and processed only inside a defined region, such as the European Union.",
        "refusal": null,
        "annotations": []
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 27,
    "completion_tokens": 24,
    "total_tokens": 51,
    "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "credits_used": 12,
    "credit_balance": 49988
  }
}

4. Stream the answer

Set stream to receive tokens as they are generated. Add stream_options.include_usage to get the usage in a final chunk.

stream = client.chat.completions.create(
    model="arklabsai/Qwen3.6-35B-A3B",
    messages=[{"role": "user", "content": "Write a haiku about Szczecin."}],
    stream=True,
    stream_options={"include_usage": True},
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="", flush=True)
    elif chunk.usage:
        print(f"\n{chunk.usage.total_tokens} tokens")

Next steps