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

# Quickstart

> Generate your first AI asset with the Layer API

This walks you through the typical generation flow end-to-end: authenticate, pick a model, estimate cost, generate, and retrieve results.

## 1. Get your API token

1. Log in to [app.layer.ai](https://app.layer.ai)
2. Go to **Settings > Personal Access Tokens**
3. Click **Create Token**, name it, and copy the value

Export it for the examples below:

```bash theme={null}
export LAYER_TOKEN="your-pat-token"
export WORKSPACE_ID="your-workspace-id"
```

## 2. Pick a model

List models and choose one that fits your use case:

```bash theme={null}
curl https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/models \
  -H "Authorization: Bearer $LAYER_TOKEN"
```

Note the `id` of the model you want to use.

## 3. Estimate cost

Check how many Creative Units the generation will consume:

```bash theme={null}
curl -X POST https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/inferences/estimate \
  -H "Authorization: Bearer $LAYER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model_id": "MODEL_ID",
    "parameters": {
      "prompt": "A medieval castle on a hilltop at sunset, game concept art",
      "width": 1024,
      "height": 1024
    }
  }'
```

## 4. Generate

```bash theme={null}
curl -X POST https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/inferences \
  -H "Authorization: Bearer $LAYER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model_id": "MODEL_ID",
    "parameters": {
      "prompt": "A medieval castle on a hilltop at sunset, game concept art",
      "width": 1024,
      "height": 1024
    }
  }'
```

This returns immediately with an `inference_id` and `status: "IN_PROGRESS"`.

## 5. Poll for results

```bash theme={null}
curl https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/inferences/INFERENCE_ID \
  -H "Authorization: Bearer $LAYER_TOKEN"
```

When `status` is `COMPLETED`, the response includes URLs to your generated assets.

## Next steps

* Browse the [API reference](/api-reference/introduction) for full endpoint details and parameter documentation
* Upload [reference images](/api-reference/introduction) to guide generation with your own art style
* Use [workflows](/api-reference/introduction) to run multi-step pipelines
