Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tensormesh.ai/llms.txt

Use this file to discover all available pages before exploring further.

@tensormesh/ai-sdk-provider adds Tensormesh language models to the Vercel AI SDK. JavaScript and TypeScript applications can use AI SDK functions such as generateText and streamText while requests are sent to Tensormesh text inference endpoints. Calling tensormesh(modelId) creates a chat model backed by /v1/chat/completions. Calling tensormesh.completionModel(modelId) creates a completion model backed by /v1/completions. Structured output and tool calling are requested through chat model calls. Raw helpers expose additional inference endpoints such as /v1/responses.

Install

npm install ai @tensormesh/ai-sdk-provider
The package requires Node.js 20 or newer.

What It Supports

  • Serverless inference by default at https://serverless.tensormesh.ai/v1
  • Text generation and streaming with chat models over /v1/chat/completions
  • Text completions over /v1/completions
  • Structured output through AI SDK chat model calls
  • Tool calling through AI SDK chat model calls
  • Model-specific reasoning controls through providerOptions.tensormesh.chat_template_kwargs
  • Direct helper methods for /v1/models, /v1/responses, /tokenize, /detokenize, /health, and /version

Provider API

import { createTensormesh, tensormesh } from "@tensormesh/ai-sdk-provider";

// Default serverless provider.
const model = tensormesh("deepseek-ai/DeepSeek-V4-Flash");

// Explicit provider configuration.
const serverless = createTensormesh({
  apiKey: process.env.TENSORMESH_INFERENCE_API_KEY,
});
The default provider instance, tensormesh, is equivalent to createTensormesh() with serverless defaults. Authenticated requests read TENSORMESH_INFERENCE_API_KEY unless you pass apiKey explicitly. Importing or creating a provider instance does not require an API key.

Common Guides