open-index/open-npm huggingface dataset:
npm package: @llmgateway/ai-sdk-provider
Description: Forked from https://github.com/OpenRouterTeam/ai-sdk-provider
Latest version: 3.6.0

# LLMGateway Provider for Vercel AI SDK

Forked from https://github.com/OpenRouterTeam/ai-sdk-provider

The [LLMGateway](https://llmgateway.io/) provider for the [Vercel AI SDK](https://sdk.vercel.ai/docs) gives access to over 300 large language model on the LLMGateway chat and completion APIs.

# AI SDK version support

- For AI SDK v4 or lower, use `@llmgateway/ai-sdk-provider@1.x.x`.
- For AI SDK v5, use `@llmgateway/ai-sdk-provider@2.x.x`.
- For AI SDK v6, use `@llmgateway/ai-sdk-provider@3.x.x`.

## Setup

```bash
# For npm
npm install @llmgateway/ai-sdk-provider

# For pnpm
pnpm add @llmgateway/ai-sdk-provider

# For yarn
yarn add @llmgateway/ai-sdk-provider
```

## Provider Instance

You can import the default provider instance `llmgateway` from `@llmgateway/ai-sdk-provider`:

```ts
import { llmgateway } from '@llmgateway/ai-sdk-provider';
```

## Example

```ts
import { llmgateway, createLLMGateway } from '@llmgateway/ai-sdk-provider';
import { generateText } from 'ai';

const llmgateway = createLLMGateway({
  apiKey: process.env.LLM_GATEWAY_API_KEY,
});

const { text } = await generateText({
  model: llmgateway('openai/gpt-4o'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});

console.log(`response: ${text}`);
```

## Supported models

You can find the latest list of models supported by LLMGateway [here](https://llmgateway.io/models).