> For the complete documentation index, see [llms.txt](https://docs.apismart.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apismart.ai/help-and-resources/frequently-asked-questions.md).

# Frequently Asked Questions

Find answers to common questions about ApiSmart API Keys, models, text, image and video generation, billing, usage, and API errors.

Find quick answers to common questions about using the ApiSmart API.

For detailed integration examples, see [**Quick Start**](/welcome-to-apismart/quick-start.md) or the corresponding API guide.

### 🔑 API Access

#### What is the ApiSmart API Base URL?

Use:

```
https://gw.apismart.ai/v1
```

All authenticated requests use an API Key in the `Authorization` header:

```http
Authorization: Bearer <your-api-key>
```

#### Where do I use my API Key?

Include your API Key in the `Authorization` header of each authenticated API request.

Do not expose API Keys in frontend code, public repositories, screenshots, or application logs.

See [**Create and Manage API Keys**](/welcome-to-apismart/api-keys/create-and-manage-api-keys.md) and [**Secure Your API Keys**](/welcome-to-apismart/api-keys/secure-your-api-keys.md).

#### Why am I getting `401 invalid_api_key`?

This means your API Key could not be authenticated.

Check that the key is correct and that your header uses:

```http
Authorization: Bearer <your-api-key>
```

For more help, see [**API Key and Authentication Issues**](/troubleshooting/api-key-and-authentication-issues.md).

### 🧩 Models

#### How do I find available model IDs?

Call:

```bash
curl https://gw.apismart.ai/v1/models \
  -H "Authorization: Bearer <your-api-key>"
```

Use the returned `data[].id` value in your API requests.

#### Why does a model ID have to match exactly?

ApiSmart matches model IDs exactly. Periods, hyphens, and version numbers cannot be changed.

For example:

```
glm-5.1
gpt-5.6-luna
doubao-seedance-2-0-fast
```

An incorrectly written model ID may result in an unexpected `503`, so verify the model ID character by character.

#### Why do I get `403 model_not_allowed` even though the model appears in `/v1/models`?

`GET /v1/models` returns the system model list, but not every model is necessarily enabled for every API Key.

A `403 model_not_allowed` response means the selected model is not currently available to your account or API Key.

See [**Models and Model IDs**](/models-and-pricing/models-and-model-ids.md) for details.

### 💬 Text Generation

#### Which endpoint should I use for text models?

Use:

```
POST /v1/chat/completions
```

ApiSmart text models use an OpenAI-compatible Chat Completions request format.

#### Does Chat Completions support streaming?

Yes.

Add:

```json
{
  "stream": true
}
```

to the request body to enable streaming output.

See [**Chat Completions API**](/api-guides/chat-completions-api.md) and [**Response Modes**](/api-guides/response-modes.md).

### 🖼️ Image Generation

#### How long does image generation take?

Image generation is synchronous by default.

A single image typically takes around **20–40 seconds**. High-resolution, multi-reference, or sequential image generation may take longer.

Set your client timeout to at least **90 seconds**.

#### Can I use reference images?

Yes.

The Image Generation API supports:

* Text-to-image
* Single reference image
* Multiple reference images
* Sequential image generation
* Streaming output

Up to **14 reference images** are supported, subject to the documented image limits.

See [**Image Generation API**](/api-guides/image-generation-api.md) for complete requirements.

#### Can I upload a local image?

Yes.

Use:

```
POST /v1/images/edits
```

with multipart form data.

Each uploaded image must be no larger than **10 MB**, and up to 14 reference images are supported.

#### Where can I find previously generated images?

Use:

```
GET /v1/images
```

to retrieve recent image generation history.

The history API currently allows you to query records from the most recent **7 days**.

See [**Generated Media History**](/api-usage/generated-media-history.md).

### 🎬 Video Generation

#### Is video generation synchronous?

No.

Video generation uses an asynchronous task workflow:

```
POST /v1/video/tasks
        ↓
Receive task ID
        ↓
GET /v1/video/tasks/{id}
```

Your application should create the task and then query its status until generation completes.

#### What video task statuses can I receive?

Possible statuses include:

| Status      | Meaning                |
| ----------- | ---------------------- |
| `queued`    | Waiting in queue       |
| `running`   | Generation in progress |
| `succeeded` | Generation completed   |
| `failed`    | Generation failed      |
| `cancelled` | Task cancelled         |
| `expired`   | Task expired           |

Continue polling while the task is `queued` or `running`.

#### Why should I specify video resolution and duration explicitly?

Video billing and supported settings vary by model.

For example, HappyHorse defaults to **1080p billing** when resolution is omitted and **5 seconds** when duration is omitted. Seedance uses different resolution rules.

To avoid unexpected costs or unsupported settings, specify these parameters explicitly where recommended.

See [**Video Generation API**](/api-guides/video-generation-api.md) and [**Model Pricing and Billing**](/models-and-pricing/model-pricing-and-billing.md).

#### Where can I find previously generated videos?

Use:

```
GET /v1/videos
```

The endpoint returns recently completed successful video generations.

Only the most recent **7 days** can currently be queried, and queued, running, or failed tasks are not included.

For active tasks, use `GET /v1/video/tasks/{id}` instead.

### 💰 Billing and Usage

#### How are API requests billed?

Billing depends on the selected model and workload.

Text, image, and video models can use different billing methods. Image generation may be billed by delivered image results, while video pricing can depend on model, duration, resolution, or generated tokens.

For current pricing and billing rules, see [**Model Pricing and Billing**](/models-and-pricing/model-pricing-and-billing.md).

#### What does `402 insufficient_quota` mean?

Your account does not have sufficient available balance to complete the request.

Check your wallet balance and recent usage before retrying.

See [**Balance and Usage Limit Issues**](/troubleshooting/balance-and-usage-limit-issues.md).

#### What does `429 rate_limit_error` mean?

The service rate limit has been reached.

Reduce request frequency and retry later using controlled backoff. It does not mean that your wallet balance is insufficient.

### ⚠️ Errors and Troubleshooting

#### What should I do if I receive a `502`, `503`, or `504`?

These errors can indicate temporary provider, gateway, or network-layer problems.

Use controlled retries with exponential backoff. If the response includes `Retry-After`, follow it where applicable.

For an unexpected `503`, also verify the model ID first.

See [**Timeout and Connection Issues**](/troubleshooting/timeout-and-connection-issues.md).

#### Where can I check failed requests and costs?

Use [**Usage Logs and Costs**](/api-usage/usage-logs-and-costs.md) to review request-level information such as model, status, consumption, cost, and Request ID.

When contacting ApiSmart Support about an API request, provide the relevant **Request ID** when available.

Never provide your full API Key.

### ➡️ Need More Help?

Continue with:

* [**Quick Start**](/welcome-to-apismart/quick-start.md) — Send your first API request
* [**Models and Model IDs**](/models-and-pricing/models-and-model-ids.md) — Find valid models
* [**Model Pricing and Billing**](/models-and-pricing/model-pricing-and-billing.md) — Understand API costs
* [**Usage Logs and Costs**](/api-usage/usage-logs-and-costs.md) — Review request activity
* [**HTTP Status Codes and API Errors**](/troubleshooting/http-status-codes-and-api-errors.md) — Look up API errors
* [**Contact Support**](/help-and-resources/contact-support.md) — Get additional assistance
