> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nomask.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Create a NoMask API key and make your first OpenAI-compatible request.

This guide takes you from an API key to a text response using the OpenAI Python or JavaScript SDK, or curl. You need a NoMask account and a funded credit balance.

**1. Create an API key**

Open [API Keys](https://nomask.ai/api/keys) and select **Create Key**. Give the key a name, then optionally set an expiration date and a monthly USD spending limit.

Copy the key when it is created, or use the copy icon in your key list later.

> [!NOTE]
>
> Keep your key on your server or in a local environment variable. Do not include it in browser code or commit it to source control.

**2. Add credits**

In the [API dashboard](https://nomask.ai/api/overview), select **Buy credits** beside your balance. The funding window shows the available payment methods and current minimum purchase. Your balance updates after payment confirmation.

API usage spends the USD value of your credits. See [Billing & Funding](https://docs.nomask.ai/billing.md) for pricing and how charges are calculated.

**3. Choose a model and set your environment**

Open [Models](https://nomask.ai/models), select a text model, and copy its public model ID. You can also query the authenticated [List models endpoint](https://docs.nomask.ai/api-reference/list-models.md) with your NoMask API key.

Replace both placeholders below. `NOMASK_MODEL` must be an actual NoMask model ID from the catalog.

> [tab] macOS / Linux
>
> ```bash theme={"system"}
> export NOMASK_API_KEY="YOUR_NOMASK_API_KEY"
> export NOMASK_MODEL="YOUR_TEXT_MODEL_ID"
> ```

> [tab] Windows PowerShell
>
> ```powershell theme={"system"}
> $env:NOMASK_API_KEY = "YOUR_NOMASK_API_KEY"
> $env:NOMASK_MODEL = "YOUR_TEXT_MODEL_ID"
> ```

Run the following examples in the same terminal session so they can read these variables.

**4. Send your first request**

Choose a language. Each example calls `POST /chat/completions` at `https://api.nomask.ai/v1` and reads the assistant's reply.

> [tab] Python
>
> Install the OpenAI SDK:
>
> ```bash theme={"system"}
> python -m pip install openai
> ```
>
> Save this as `quickstart.py`:
>
> ```python theme={"system"}
> import os
> from openai import OpenAI
>
> client = OpenAI(
>     api_key=os.environ["NOMASK_API_KEY"],
>     base_url="https://api.nomask.ai/v1",
> )
>
> response = client.chat.completions.create(
>     model=os.environ["NOMASK_MODEL"],
>     messages=[{"role": "user", "content": "Say hello in five languages."}],
> )
>
> print(response.choices[0].message.content)
> ```
>
> Run it:
>
> ```bash theme={"system"}
> python quickstart.py
> ```

> [tab] JavaScript
>
> Install the OpenAI SDK in a Node.js project:
>
> ```bash theme={"system"}
> npm install openai
> ```
>
> Save this as `quickstart.mjs`:
>
> ```javascript theme={"system"}
> import OpenAI from "openai";
>
> const client = new OpenAI({
>   apiKey: process.env.NOMASK_API_KEY,
>   baseURL: "https://api.nomask.ai/v1",
> });
>
> const response = await client.chat.completions.create({
>   model: process.env.NOMASK_MODEL,
>   messages: [{ role: "user", content: "Say hello in five languages." }],
> });
>
> console.log(response.choices[0].message.content);
> ```
>
> Run it:
>
> ```bash theme={"system"}
> node quickstart.mjs
> ```

> [tab] curl
>
> Run this in Bash on macOS, Linux, or WSL. No SDK is needed.
>
> ```bash theme={"system"}
> curl https://api.nomask.ai/v1/chat/completions \
>   -H "Authorization: Bearer $NOMASK_API_KEY" \
>   -H "Content-Type: application/json" \
>   --data-binary @- <<JSON
> {
>   "model": "$NOMASK_MODEL",
>   "messages": [{"role": "user", "content": "Say hello in five languages."}]
> }
> JSON
> ```
>
> The reply is in `choices[0].message.content` in the returned JSON.

## Read the response

The SDK examples print the assistant's text. curl returns the full OpenAI-compatible `chat.completion` object.

| Field | Meaning |
| - | - |
| `choices[0].message.content` | The assistant's text response. |
| `choices[0].finish_reason` | Why generation stopped. |
| `usage` | Prompt, completion, and total token counts. |
| `nomask.cost_usd` | The amount charged to your balance. |

View settled requests and charges in your [API dashboard](https://nomask.ai/api/overview). Token usage can be estimated when model-reported counts are unavailable; usage history identifies those estimates.

## If the request fails

| Status | Check |
| - | - |
| `401` | The API key is correct, active, and present in your environment. |
| `402` | Your credit balance has enough funds. |
| `404` | The model ID matches a current entry in the NoMask catalog. |
| `429` | The error code: a rate limit or the key's monthly spending cap was reached. |

See [Errors](https://docs.nomask.ai/errors.md) for the complete error format and [Rate Limits](https://docs.nomask.ai/rate-limits.md) for retry guidance.

## Keep building

> [card] [Migrate from OpenAI](https://docs.nomask.ai/openai-compatibility.md)
>
> Reuse your Chat Completions code with NoMask's configuration and supported parameters.

> [card] [Stream a response](https://docs.nomask.ai/streaming.md)
>
> Display output as it arrives with the SDK streaming interface.

> [card] [Generate an image](https://docs.nomask.ai/image-generation.md)
>
> Choose an image model and send your first image request.

> [card] [Connect a coding tool](https://docs.nomask.ai/integration-cline.md)
>
> Set up Cline with an OpenAI-compatible NoMask provider.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.