# gizlang/providers

the kinds of model provider a program can attach, as one list: the API each speaks, its address, how an attached provider signs in, and the models its API lists. An app keeps the attached providers (their labels and keys) in its own store; this list is what every such store names.

```gizlang
import * as Providers from "gizlang/providers";
```

## Types

### `Sign`

```gizlang
type Sign = "key" | "oauth" | "sso" | "url"
```

How an attached provider signs in: "key" an API key; "oauth" a subscription sign-in; "sso" the Giz account
(gizlang/signin); "url" the address of a server, a key optional.

### `Kind`

```gizlang
type Kind = { id: string; name: string; wire: Wire; base: string; sign: Sign; window: i64; }
```

A kind of provider: its id (the prefix of its models' names, "openai:gpt-5"), its name, the wire and address of
its API ("": each attached provider gives its own), how one signs in and its context window (0: its API says).

- `id`: `string`
- `name`: `string`
- `wire`: `string`
- `base`: `string`
- `sign`: `string`
- `window`: `i64`

### `Listed`

```gizlang
type Listed = { id: string; name: string; kind: string; tools: bool; context: i64; price: string; }
```

A model an API lists: its id, its name (its id when the API gives none), its kind ("language" for a chat model;
"" when the API does not say), whether it takes tools ("tools" in its supported_parameters; true when the API does
not say), its context window in tokens (0: the API does not say) and its price ("": not said).

- `id`: `string`
- `name`: `string`
- `kind`: `string`
- `tools`: `bool`
- `context`: `i64`
- `price`: `string`

## Functions

### `kinds`

```gizlang
function kinds(): Vec<Kind>
```

The kinds of provider. `gizstack` is GizStack's AI Gateway and `gizai` giz.ai's API, both with the Giz account;
`compatible` any server of the OpenAI API; `worker` a Gizlang model server (`giz ai serve`).

Effects: fail, alloc.

### `kind`

```gizlang
function kind(id: string): Option<Kind>
```

The kind of `id`.

Effects: fail, alloc.

### `models`

```gizlang
function models(c: ModelApi): Vec<Listed> throws string
```

The models `c` offers (GET /models, as its wire lists them), in its order.

Effects: fail, read, write, console, io, alloc.

