Chatoyant - Typesafe LLM provider clients for TypeScript.
Native fetch, streaming, structured outputs, zero dependencies.
// Unified high-level API (recommended)import { Chat, genText, genData } from 'chatoyant';const answer = await genText("What is 2+2?");const chat = new Chat({ model: "gpt-4o" });for await (const chunk of chat.user("Hello").stream()) { process.stdout.write(chunk);}// Low-level provider clientsimport { createOpenAIClient } from 'chatoyant/providers/openai';import { createAnthropicClient } from 'chatoyant/providers/anthropic';import { createXAIClient } from 'chatoyant/providers/xai';// Utilitiesimport { Schema } from 'chatoyant/schema';import { estimateTokens, calculateCost } from 'chatoyant/tokens'; Copy
// Unified high-level API (recommended)import { Chat, genText, genData } from 'chatoyant';const answer = await genText("What is 2+2?");const chat = new Chat({ model: "gpt-4o" });for await (const chunk of chat.user("Hello").stream()) { process.stdout.write(chunk);}// Low-level provider clientsimport { createOpenAIClient } from 'chatoyant/providers/openai';import { createAnthropicClient } from 'chatoyant/providers/anthropic';import { createXAIClient } from 'chatoyant/providers/xai';// Utilitiesimport { Schema } from 'chatoyant/schema';import { estimateTokens, calculateCost } from 'chatoyant/tokens';
Chatoyant - Typesafe LLM provider clients for TypeScript.
Native fetch, streaming, structured outputs, zero dependencies.
Example