Skip to Content
ProvidersUse Jev with Modem

Jev

The Client SDK has no Jev method. Get a gateway configuration from the Client SDK and pass it to the TypeSafe AI SDK.

The gateway serves System One at /v1/systemone, without streaming. A System One usage limit can measure requests and tokens.

Install the SDKs

bun add @preternatural-js/client-sdk @typesafe-ai/sdk

Get the gateway configuration

Use the client from Configure the Client SDK, with a signed-in customer.

import { ServiceProvider } from '@preternatural-js/client-sdk' const modelIdentifier = 'jev-latest' const gateway = await client.gateway.providerConfiguration({ provider: ServiceProvider.typesafeAI, modelIdentifier, productId: 'your-product-id' })

Create the TypeSafe AI client

The gateway URL ends in /v1, and the TypeSafe SDK adds /v1/systemone, so remove the final /v1. Pass the gateway headers as defaultHeaders.

import { TypeSafeClient } from '@typesafe-ai/sdk' const typeSafeBaseURL = gateway.baseURL.replace(/\/v1\/?$/, '') const jev = new TypeSafeClient({ // TypeSafeClient requires a non-empty API key value. apiKey: 'PRETERNATURAL_GATEWAY_AUTHENTICATES_REQUESTS', baseURL: typeSafeBaseURL, defaultHeaders: gateway.headers, defaultModel: modelIdentifier, fetch: gateway.fetchImpl, retry: { maxRetries: 0 }, })

Send a System One request

import { choice } from '@typesafe-ai/sdk' const result = await jev.systemOne({ state: { message: 'I was charged twice. Please refund the duplicate charge.' }, questions: { category: choice('Which team should handle this request?', { billing: 'Questions about charges, payments, and refunds', technical: 'Problems using the product', other: 'Requests that do not fit another category' }) } }) console.log(result.answers.category.choice)