npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@telnyx/ai-sdk-provider

v1.0.0

Published

Telnyx provider for Vercel AI SDK — LLM, Embeddings, TTS, STT in a single package

Readme

@telnyx/ai-sdk-provider

Telnyx provider for the Vercel AI SDK, with support for chat, embeddings, speech generation, and transcription.

Setup

npm install ai @telnyx/ai-sdk-provider zod

zod is a required peer dependency. This package imports zod/v4 internally for speech and transcription model schemas, so consumers must install it even if they are not using tool calling.

Set your Telnyx API key:

export TELNYX_API_KEY="your_api_key_here"

Usage

Chat (LLM)

import { telnyx } from '@telnyx/ai-sdk-provider';
import { generateText } from 'ai';

const { text } = await generateText({
  model: telnyx('Qwen/Qwen3-235B-A22B'),
  prompt: 'Explain WebRTC in simple terms',
});

Streaming

import { telnyx } from '@telnyx/ai-sdk-provider';
import { streamText } from 'ai';

const result = streamText({
  model: telnyx('moonshotai/Kimi-K2.5'),
  prompt: 'Write a poem about the cloud',
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Tool Calling

import { telnyx } from '@telnyx/ai-sdk-provider';
import { generateText, tool } from 'ai';
import { z } from 'zod/v4';

const { text } = await generateText({
  model: telnyx('Qwen/Qwen3-235B-A22B'),
  prompt: 'What is the weather in Santiago, Chile?',
  tools: {
    weather: tool({
      description: 'Get the current weather for a location',
      inputSchema: z.object({
        location: z.string(),
      }),
      execute: async ({ location }) => {
        return { temperature: 18, condition: 'sunny', location };
      },
    }),
  },
});

Embeddings

import { telnyx } from '@telnyx/ai-sdk-provider';
import { embed, embedMany } from 'ai';

// Single embedding
const { embedding } = await embed({
  model: telnyx.embeddingModel('thenlper/gte-large'),
  value: 'What is WebRTC?',
});

// Batch embeddings
const { embeddings } = await embedMany({
  model: telnyx.embeddingModel('thenlper/gte-large'),
  values: ['What is WebRTC?', 'Explain SIP trunking'],
});

Text-to-Speech (TTS)

import { telnyx } from '@telnyx/ai-sdk-provider';
import { experimental_generateSpeech as generateSpeech } from 'ai';

const { audio } = await generateSpeech({
  model: telnyx.speechModel('tts-1'),
  text: 'Hello, welcome to Telnyx!',
  voice: 'Telnyx.NaturalHD.astra',
});

You can also pass additional speech options:

import { telnyx } from '@telnyx/ai-sdk-provider';
import { experimental_generateSpeech as generateSpeech } from 'ai';

const { audio, warnings } = await generateSpeech({
  model: telnyx.speechModel('tts-1'),
  text: 'Hello, welcome to Telnyx!',
  voice: 'Telnyx.KokoroTTS.af_alloy',
  outputFormat: 'mp3',
});

Provider-specific options are also supported via providerOptions.telnyx:

const { audio } = await generateSpeech({
  model: telnyx.speechModel('tts-1'),
  text: 'Hello, welcome to Telnyx!',
  voice: 'Telnyx.NaturalHD.astra',
  providerOptions: {
    telnyx: {
      output_format: 'linear16',
      sample_rate: 24000,
      language_code: 'en',
    },
  },
});

Transcription (STT)

import { telnyx } from '@telnyx/ai-sdk-provider';
import { experimental_transcribe as transcribe } from 'ai';
import { readFile } from 'node:fs/promises';

const result = await transcribe({
  model: telnyx.transcriptionModel('distil-whisper/distil-large-v2'),
  audio: await readFile('./audio.wav'),
  mediaType: 'audio/wav',
});

console.log(result.text);

You can also use provider-specific options:

const result = await transcribe({
  model: telnyx.transcriptionModel('openai/whisper-large-v3-turbo'),
  audio: await readFile('./audio.wav'),
  mediaType: 'audio/wav',
  providerOptions: {
    telnyx: {
      language: 'en',
      response_format: 'verbose_json',
    },
  },
});

Custom Instance

import { createTelnyx } from '@telnyx/ai-sdk-provider';

const telnyx = createTelnyx({
  apiKey: 'KEY_ID_SECRET',
  baseURL: 'https://api.telnyx.com/v2/ai/openai',
  fetch: customFetch, // optional custom fetch implementation
});

Available Models

Chat Models

| Model ID | Best For | |---|---| | moonshotai/Kimi-K2.5 | General use, voice AI | | zai-org/GLM-5.1-FP8 | Highest intelligence open-source | | MiniMaxAI/MiniMax-M2.7 | Cost-effective, high intelligence | | Qwen/Qwen3-235B-A22B | Function calling, reasoning |

Embedding Models

| Model ID | Dimensions | |---|---| | thenlper/gte-large | 1024 |

Speech Models

| Model ID | Description | |---|---| | tts-1 | Supported model identifier for AI SDK speech APIs | | tts-1-hd | Supported model identifier for AI SDK speech APIs |

Note: for the current Telnyx TTS implementation, modelId is used as the AI SDK model identifier and for metadata/logging. The actual synthesis request is controlled by options such as voice, outputFormat, and provider-specific providerOptions.telnyx, not by a different upstream TTS model selected via modelId.

Transcription Models

Examples:

  • distil-whisper/distil-large-v2
  • openai/whisper-large-v3-turbo
  • deepgram/nova-3

Exports

import {
  telnyx,
  createTelnyx,
  VERSION,
  type TelnyxProviderSettings,
  type TelnyxChatModelId,
  type TelnyxEmbeddingModelId,
  type TelnyxSpeechModelId,
  type TelnyxTranscriptionModelId,
} from '@telnyx/ai-sdk-provider';

Notes

  • telnyx('model-id') is an alias for telnyx.languageModel('model-id')
  • telnyx.speech() and telnyx.speechModel() are equivalent
  • telnyx.transcription() and telnyx.transcriptionModel() are equivalent
  • imageModel() is not supported and throws NoSuchModelError
  • The default telnyx export is lazy, so importing it does not require TELNYX_API_KEY until first use
  • Requires ai@6 for speech and transcription APIs

License

MIT