EDlabsEDcheck

Connect the AI

The provider is who asks Jev. TypeSafe direct, Vercel AI Gateway, or whatever the env vars say.

EDcheck does not call the AI on its own. You pass a provider to createEDcheck. That object knows which API to hit.

Which one to use

ProviderWhenAuth
typesafeProviderThe simplest path. No extra packages.TYPESAFE_API_KEY
gatewayProviderIf you already bill through Vercel AI Gateway.AI_GATEWAY_API_KEY or Vercel OIDC
providerFromEnvLet it pick from environment variables.Reads both keys above

TypeSafe direct

import { createEDcheck, typesafeProvider } from "@edteam/edcheck"; const edcheck = createEDcheck({  provider: typesafeProvider({    apiKey: process.env.TYPESAFE_API_KEY!,  }),});

Optional: model (default jev-latest), baseUrl, retries, and retryDelayMs.

Vercel AI Gateway

This path needs extra packages. Install them only if you go through Gateway:

yarn add ai @ai-sdk/gateway
import { createEDcheck, gatewayProvider } from "@edteam/edcheck"; const edcheck = createEDcheck({  provider: gatewayProvider(),});

On Vercel you can skip apiKey. Gateway uses OIDC. Locally, set AI_GATEWAY_API_KEY.

Let the environment choose

import { createEDcheck, providerFromEnv } from "@edteam/edcheck"; const edcheck = createEDcheck({  provider: providerFromEnv(),});

By default, if both keys exist, TypeSafe wins. That way you do not depend on the Gateway packages. You can switch it with prefer: "gateway".

If no key is set (an empty string counts as missing), it throws EDcheckConfigError with the code missing_api_key.

Do not use these providers in tests. Use mockProvider, which is on the next page, “Test without the internet”.