summaryrefslogtreecommitdiffhomepage
path: root/js/src/provider/provider.ts
blob: d4719ffbbf9c4e0454d314d5afb6544180c4fa24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import z from "zod";

export namespace Provider {
  export const Model = z
    .object({
      id: z.string(),
      name: z.string().optional(),
      cost: z.object({
        input: z.number(),
        inputCached: z.number(),
        output: z.number(),
        outputCached: z.number(),
      }),
      contextWindow: z.number(),
      maxOutputTokens: z.number().optional(),
      attachment: z.boolean(),
      reasoning: z.boolean().optional(),
    })
    .openapi({
      ref: "Provider.Model",
    });
  export type Model = z.output<typeof Model>;

  export const Info = z
    .object({
      id: z.string(),
      name: z.string(),
      options: z.record(z.string(), z.any()).optional(),
      models: Model.array(),
    })
    .openapi({
      ref: "Provider.Info",
    });
  export type Info = z.output<typeof Info>;
}