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

# TypeSafe API reference

> API reference for the TypeSafe plugin in Corsair: every `typesafe.api.*` operation with its input and output types, taken from the plugin's Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Models

### list

`models.list`

List the TypeSafe model names and aliases this key can use, such as jev-latest

**Risk:** `read`

```ts theme={null}
await corsair.typesafe.api.models.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `models` | `object[]` | Yes | — |

> [accordion] models full type
>
> ```ts theme={null}
> {
>   name: string,
>   description: string,
>   release_date: string
> }[]
> ```

***

## System One

### ask

`systemOne.ask`

Ask Jev typed questions about text, JSON or images in one call: yes/no (probability), choice (one option), score (ordered levels) or box (locate in an image). Answers come back with calibrated probabilities.

**Risk:** `read`

```ts theme={null}
await corsair.typesafe.api.systemOne.ask({ state: { message: 'I was charged twice for my order.' }, questions: { billing: { type: 'noul', instructions: 'Is `message` about billing?' }, urgency: { type: 'score', instructions: 'How urgent is `message`?', criteria: ['Can wait', 'Needs attention this week', 'Needs attention today'] } } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model` | `string` | No | Model name or alias from models.list. jev-latest moves with each release; pin a version such as jev-1.14.0 to keep answers stable. Defaults to "jev-latest". |
| `state` | `string \| Record<string, any> \| any[]` | Yes | The content every question is about: text, or JSON with descriptive keys. Leave out fields no question needs. |
| `questions` | `object` | Yes | Questions keyed by a name you choose; answers come back under the same names. Questions run in parallel and cannot see each other. |
| `assets` | `object` | No | Images keyed by a placeholder string. Each placeholder in state, instructions or criteria is replaced by its image. Images are experimental at TypeSafe. |
| `longContext` | `boolean` | No | Raise the context limit from 64k (32k per question) to 262k tokens. Slower and less accurate, same price per token. |

> [accordion] questions full type
>
> ```ts theme={null}
> Record<string, {
>   type: noul,
>   instructions?: string | Record<string, any> | any[] | null,
>   criteria?: {
>     true?: string | Record<string, any> | any[] | null,
>     false?: string | Record<string, any> | any[] | null
>   } | null
> } | {
>   type: choice,
>   instructions?: string | Record<string, any> | any[] | null,
>   criteria: Record<string, string | Record<string, any> | any[] | null>
> } | {
>   type: score,
>   instructions?: string | Record<string, any> | any[] | null,
>   criteria: (string | Record<string, any> | any[])[]
> } | {
>   type: box,
>   instructions?: string | Record<string, any> | any[] | null
> }>
> ```

> [accordion] assets full type
>
> ```ts theme={null}
> Record<string, {
>   type: image,
>   format: png | jpg | jpeg,
>   data_base64: string
> }>
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model` | `string` | Yes | Versioned model that answered |
| `answers` | `object` | Yes | — |
| `usage` | `object` | Yes | — |

> [accordion] answers full type
>
> ```ts theme={null}
> Record<string, {
>   type: noul,
>   noul: number
> } | {
>   type: choice,
>   choice: string,
>   confidence: number,
>   probabilities: Record<string, number>
> } | {
>   type: score,
>   score: number,
>   confidence: number,
>   legend?: Record<string, any>,
>   probabilities?: Record<string, number>
> } | {
>   type: box,
>   box: {
>     top: number,
>     bottom: number,
>     left: number,
>     right: number
>   },
>   confidence: number | null
> }>
> ```

> [accordion] usage full type
>
> ```ts theme={null}
> {
>   input_tokens: number,
>   output_tokens: number
> }
> ```

***


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