JSPM

  • Created
  • Published
  • Downloads 457
  • Score
    100M100P100Q87420F
  • License MIT

AI SDK for building AI Agents with any LLM

Package Exports

  • @yourgpt/llm-sdk
  • @yourgpt/llm-sdk/adapters
  • @yourgpt/llm-sdk/anthropic
  • @yourgpt/llm-sdk/azure
  • @yourgpt/llm-sdk/google
  • @yourgpt/llm-sdk/ollama
  • @yourgpt/llm-sdk/openai
  • @yourgpt/llm-sdk/openrouter
  • @yourgpt/llm-sdk/xai

Readme

@yourgpt/llm-sdk

Multi-provider LLM SDK with streaming. One API, any provider.

Installation

npm install @yourgpt/llm-sdk @anthropic-ai/sdk

For other providers (OpenAI, Google, xAI), see Providers Documentation.

Quick Start

// app/api/chat/route.ts
import { streamText } from "@yourgpt/llm-sdk";
import { anthropic } from "@yourgpt/llm-sdk/anthropic";

export async function POST(req: Request) {
  const { messages } = await req.json();

  const result = await streamText({
    model: anthropic("claude-sonnet-4-20250514"),
    system: "You are a helpful assistant.",
    messages,
  });

  return result.toTextStreamResponse();
}
# .env.local
ANTHROPIC_API_KEY=sk-ant-...

With Copilot SDK

Use createRuntime for full Copilot SDK integration with tools support:

// app/api/chat/route.ts
import { createRuntime } from "@yourgpt/llm-sdk";
import { createAnthropic } from "@yourgpt/llm-sdk/anthropic";

const runtime = createRuntime({
  provider: createAnthropic({ apiKey: process.env.ANTHROPIC_API_KEY }),
  model: "claude-sonnet-4-20250514",
  systemPrompt: "You are a helpful assistant.",
});

export async function POST(req: Request) {
  return runtime.stream(await req.json()).toResponse();
}

Documentation

Visit copilot-sdk.yourgpt.ai for full documentation:

License

MIT