Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

client.ts

19 lines663 Bytes

1/**
2 * The modelschemas client for the model sync scripts. `MODELSCHEMAS_API_KEY`
3 * raises the rate limit. This file has no relative imports, so a script that
4 * runs with plain `node` can import it.
5 */
6​
7import { createModelschemasClient } from '@modelschemas/client'
8​
9export function createSyncClient(options?: {
10 apiKey?: string
11 fetch?: typeof globalThis.fetch
12}): ReturnType<typeof createModelschemasClient> {
13 const apiKey = options?.apiKey ?? process.env.MODELSCHEMAS_API_KEY
14 return createModelschemasClient({
15 baseUrl: 'https://modelschemas.com',
16 ...(apiKey ? { apiKey } : {}),
17 ...(options?.fetch ? { fetch: options.fetch } : {}),
18 })