xsAI v0.4 "AIAIAI" is now available! Read Announcement
xsAI0.4.2

Providers

Collection of predefined providers.

This package is not recommended for xsAI-based libraries, which can increase the size of the installation.

npm i @xsai-ext/providers

Usage

Predefined

It reads the API Key from the environment variables via process.env, so it cannot be used in a browser.

import {  } from '@xsai-ext/providers'
import {  } from '@xsai/generate-text'
import {  } from 'node:process'

const {  } = await ({
  ....('gemini-2.5-flash'), 
  : .!, 
  : 'https://generativelanguage.googleapis.com/v1beta/openai/', 
  : [{
    : 'Why is the sky blue?',
    : 'user'
  }],
  : 'gemini-2.5-flash', 
})

Create

You can also import a create function instead of a predefined provider, making it runtime-agnostic:

// import { google } from '@xsai-ext/providers'
import {  } from '@xsai-ext/providers/create'
import {  } from '@xsai/generate-text'

const  = ('YOUR_API_KEY_HERE') 

const {  } = await ({
  ....('gemini-2.5-flash'),
  : [{
    : 'Why is the sky blue?',
    : 'user'
  }],
})

On this page