# Models

Source: https://staging-docs.aiand.com/api/models/

```http
GET /v1/models
```

Returns all available models with pricing and metadata.

## Example

```bash
curl https://api.aiand.com/v1/models \
  -H "Authorization: Bearer sk-your-api-key"
```

## Response

```json
{
  "object": "list",
  "data": [
    {
      "id": "openai/gpt-oss-120b",
      "object": "model",
      "created": 1700000000,
      "owned_by": "ai&",
      "provider": "openai",
      "context_window": 128000,
      "description": "Fast, affordable small model for lightweight tasks",
      "currency": "usd",
      "input_per_1m": "0.150000",
      "output_per_1m": "0.600000"
    }
  ]
}
```

### Model object

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Model identifier — use this as the `model` parameter in requests |
| `object` | string | Always `"model"` |
| `created` | integer | Unix timestamp |
| `owned_by` | string | Always `"ai&"` |
| `provider` | string | Upstream provider name |
| `context_window` | integer | Maximum context length in tokens |
| `description` | string | Short model description |
| `currency` | string | Your organization's billing currency (`usd` or `jpy`) |
| `input_per_1m` | string | Cost per 1M input tokens, in your billing currency. Numeric value returned as a string for precision (e.g. `"0.150000"`) |
| `output_per_1m` | string | Cost per 1M output tokens, in your billing currency |

## Example

```bash
curl https://api.aiand.com/v1/models \
  -H "Authorization: Bearer sk-your-api-key"
```

## Model name resolution

The `model` parameter you send on an inference request (`/v1/chat/completions`, `/v1/completions`, `/v1/responses`, `/v1/messages`) is resolved as follows:

1. **Exact match** (case-insensitive) against a model `id` always wins.
2. Otherwise, the value is treated as a **prefix**: the request resolves to the highest-priority model whose `id` starts with it.

This lets you pin to a model family without naming an exact version. For example, with `kimi-2.6` and `kimi-2.7` both available, sending `"model": "kimi"` resolves to whichever the catalog lists first (the higher-priority version). Sending `"model": "kimi-2.6"` still resolves to that exact version. If nothing matches, the request returns a `400` listing `GET /v1/models` as the source of valid names.

Usage is always recorded and billed against the resolved model's canonical `id`, regardless of which prefix you sent.

## Cost calculation

```
cost = (input_tokens / 1_000_000 * input_per_1m) + (output_tokens / 1_000_000 * output_per_1m)
```

Credits are deducted after each successful request. Failed requests (4xx/5xx) are not billed.
