# Quickstart

From a new account to your first answer through the API.

Source: https://docs.noduma.dev/quickstart/

1. **Create your account.** Open the [Noduma app](https://app.noduma.dev), choose **Create your account** and confirm your email with the link or the 6-digit code it sends. Choose **Use AI** or **Both**.

2. **Get credits.** An account created in the Noduma app starts with no credits. Earn them by [sharing a PC](/contributors/), or ask the Noduma maintainers at contact@noduma.dev. If you share a PC of your own, its answers to you are free: send your requests to [My PCs](/concepts/routing/#own-my-pcs). Credits are not money: they cannot be bought or paid out.

3. **Create an API key.** In the Noduma app, open **API keys** and create a named key. It starts with `ndm_k_` and is shown once: keep it like a password. **Revoke** ends it at once.

   ```sh
   export NODUMA_API_KEY=ndm_k_...
   ```

4. **List the models** and see which ones a PC serves now (`"state": "ready"`) and their price:

   ```sh
   curl https://app.noduma.dev/v1/models -H "Authorization: Bearer $NODUMA_API_KEY"
   ```

5. **Send a request.** Use a model whose state is `ready`:

**curl**

   ```sh
   curl https://app.noduma.dev/v1/chat/completions \
     -H "Authorization: Bearer $NODUMA_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "model": "qwen2.5-7b-instruct-q4_k_m",
       "messages": [{"role": "user", "content": "Explain in one sentence what a GPU does."}]
     }'
   ```

**Python**

   ```python
   # pip install openai
   import os
   from openai import OpenAI

   client = OpenAI(base_url="https://app.noduma.dev/v1", api_key=os.environ["NODUMA_API_KEY"])
   answer = client.chat.completions.create(
       model="qwen2.5-7b-instruct-q4_k_m",
       messages=[{"role": "user", "content": "Explain in one sentence what a GPU does."}],
   )
   print(answer.choices[0].message.content)
   ```

**JavaScript**

   ```js
   // npm install openai
   import OpenAI from 'openai';

   const client = new OpenAI({ baseURL: 'https://app.noduma.dev/v1', apiKey: process.env.NODUMA_API_KEY });
   const answer = await client.chat.completions.create({
     model: 'qwen2.5-7b-instruct-q4_k_m',
     messages: [{ role: 'user', content: 'Explain in one sentence what a GPU does.' }],
   });
   console.log(answer.choices[0].message.content);
   ```

6. **Read the cost.** Every answer carries what it cost in `usage.noduma_cost`, in credits, and the price it was charged at in `usage.noduma_price_per_1k_tokens`. See [Usage and cost](/api/usage-and-cost/).

## If it fails

| Answer | What it means |
|---|---|
| `401 invalid_api_key` | The key is missing, mistyped or revoked |
| `402 insufficient_credits` | The balance does not cover the answer; see step 2 |
| `503 model_not_available` | The model is on Noduma's list but no PC serves it right now; try another model or later |
| `404 model_not_found` | The name is not on Noduma's list; copy it from `/v1/models` |

Every error is in [Errors](/api/errors/).

## Next

- [Streaming](/api/streaming/) to show words as they are written.
- [SDK examples](/sdk-examples/) for streaming, tools and the routing header in Python and JavaScript.
- [Routing](/concepts/routing/) to know who can read your request.
