open-index/open-npm huggingface dataset:
npm package: @friendliai/ai-provider
Description: <!-- header start --> <p align="center">   <img src="https://huggingface.co/datasets/FriendliAI/documentation-images/resolve/main/model-card-assets/friendliai.png" width="100%" alt="FriendliAI Logo"> </p> <!-- header end -->
Latest version: 1.1.11

<!-- header start -->
<p align="center">
  <img src="https://huggingface.co/datasets/FriendliAI/documentation-images/resolve/main/model-card-assets/friendliai.png" width="100%" alt="FriendliAI Logo">
</p>
<!-- header end -->

# @friendliai/ai-provider

[![npm](https://img.shields.io/npm/v/@friendliai/ai-provider)](https://www.npmjs.com/package/@friendliai/ai-provider)
[![npm](https://img.shields.io/npm/dt/@friendliai/ai-provider)](https://www.npmjs.com/package/@friendliai/ai-provider)

A provider to use FriendliAI models with the Vercel AI SDK and OpenAI-compatible APIs.

## Installation

```bash
npm i @friendliai/ai-provider
```

## Example

```ts
import { friendli } from '@friendliai/ai-provider';
import { generateText } from 'ai';

const { text } = await generateText({
  model: friendli('meta-llama-3.3-70b-instruct'),
  prompt: 'What is the meaning of life?',
  maxTokens: 20,
  topK: 10,
  providerOptions: {
    friendliai: {
      minP: 0.2,
    },
  },
});
console.log(text);
```

### Provider Options

You can pass Friendli-specific parameters using `providerOptions.friendliai`. For backward compatibility, the `friendli` key is also supported.

Supported options (camelCase):

- `minP`
- `repetitionPenalty`
- `xtcThreshold`
- `xtcProbability`
- `parallelToolCalls`
- `regex` (BETA: Force output to satisfy a regular expression)
- `chat_template_kwargs`

For more details, see the [official documentation](https://friendli.ai/docs/).