Crosshatch
This community provider is not yet compatible with AI SDK 5. Please wait for the provider to be updated or consider using an AI SDK 5 compatible provider.
The Crosshatch provider supports secure inference from popular language models with permissioned access to data users share, giving responses personalized with complete user context.
It creates language model objects that can be used with the generateText and streamText functions, and supports structured data generation with Output.
Setup
The Crosshatch provider is available via the @crosshatch/ai-provider module.
You can install it with:
$ pnpm add @crosshatch/ai-provider
$ npm install @crosshatch/ai-provider
$ yarn add @crosshatch/ai-provider
$ bun add @crosshatch/ai-provider
The Crosshatch provider supports all of their available models such as OpenAI's GPT and Anthropic's Claude. This provider also supports the querying interface for controlling Crosshatch's custom data integration behaviors. This provider wraps the existing underlying providers (@ai-sdk/openai, @ai-sdk/anthropic.
Credentials
The Crosshatch provider is authenticated by user-specific tokens, enabling permissioned access to personalized inference.
You can obtain synthetic and test user tokens from the your Crosshatch developer dashboard.
Production user tokens are provisioned and accessed with the Link SDK using your Crosshatch developer client id.
Provider Instance
To create a Crosshatch provider instance, use the createCrosshatch function:
Language Models
You can create Crosshatch models using a provider instance.
To create a model instance, call the provider instance and specify the model you would like to use in the first argument. In the second argument, specify the user auth token, desired context, and model arguments. You can use Crosshatch to get generated text based on permissioned user context and your favorite language model.
Example: Generate Text with Context
This example uses gpt-4o-mini to generate text.
Example: Recommend Items based on Context
Use crosshatch to re-rank items based on recent user purchases.