# API: Models and routing

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/models` | Every model you can use now, with its lowest list price per token, context length, supported parameters and whether its prices are confirmed, and the base URL to send requests to. include=pending also lists models waiting for a provider. No key needed (no sign-in) | — |
| GET | `/v1/models/:author/:name/endpoints` | One model's providers: each one's list price, context, limits, data policy and capabilities. No key needed (no sign-in) | — |
| POST | `/v1/routing/preview` | Explain how a request would be routed, without sending it: every provider considered, why each was kept or left out, the order and the estimated cost | `gateway:read` |

## Examples

### GET /v1/models

Every model you can use now, with its lowest list price per token, context length, supported parameters and whether its prices are confirmed, and the base URL to send requests to. include=pending also lists models waiting for a provider. No key needed. No sign-in, so it sends no key.

```bash
curl -s "https://manage.restolayer.com/v1/models"
```

```js
const res = await fetch(`https://manage.restolayer.com/v1/models`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/models/$AUTHOR/$NAME/endpoints

One model's providers: each one's list price, context, limits, data policy and capabilities. No key needed. No sign-in, so it sends no key.

```bash
curl -s "https://manage.restolayer.com/v1/models/$AUTHOR/$NAME/endpoints"
```

```js
const res = await fetch(`https://manage.restolayer.com/v1/models/${author}/${name}/endpoints`, {
  method: "GET",
});
const data = await res.json();
```

### POST /v1/routing/preview

Explain how a request would be routed, without sending it: every provider considered, why each was kept or left out, the order and the estimated cost

```bash
curl -s -X POST "https://manage.restolayer.com/v1/routing/preview" \
  -H "Authorization: Bearer $LG_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://manage.restolayer.com/v1/routing/preview`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

Request and response schemas: [https://www.restolayer.com/openapi.json](https://www.restolayer.com/openapi.json). All resources: [API reference](https://www.restolayer.com/docs/api).
