Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

@wix/ai

Package Overview
Dependencies
Maintainers
18
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons

@wix/ai

Wix AI SDK

unpublished
npmnpm
Version
1.0.0
Version published
Weekly downloads
166
207.41%
Maintainers
18
Weekly downloads
 
Created
Source

@wix/ai

A Wix AI SDK that provides seamless integration with AI providers through the Wix AI Gateway. This package is designed to work with the Vercel AI SDK and provides type-safe access to OpenAI models via Wix's infrastructure.

Installation

npm install @wix/ai ai

Quick Start

import { generateText } from 'ai';
import { openai } from '@wix/ai';

const result = await generateText({
  model: openai('gpt-4o'),
  prompt: 'What is the capital of France?',
});

console.log(result.text);

Features

  • Vercel AI SDK compatible - Works seamlessly with the Vercel AI SDK
  • Type-safe - Full TypeScript support for model IDs and configuration
  • Wix AI Gateway - Routes requests through Wix's AI infrastructure
  • Flexible authentication - Supports both Wix context and custom API keys

API Reference

openai(modelId)

Default OpenAI provider instance. Use this for quick access to OpenAI models.

Parameters:

  • modelId - The model to use (e.g., 'gpt-4o', 'gpt-4o-mini', 'gpt-4')

Returns: LanguageModelV1 - A model instance compatible with Vercel AI SDK

import { generateText } from 'ai';
import { openai } from '@wix/ai';

const result = await generateText({
  model: openai('gpt-4o'),
  prompt: 'Hello, world!',
});

createOpenAI(config?)

Creates a custom OpenAI provider with optional configuration.

Parameters:

  • config (optional) - Configuration object
    • apiKey (optional) - Custom API key for authentication

Returns: OpenAIProvider - A provider instance for creating models

import { generateText } from 'ai';
import { createOpenAI } from '@wix/ai';

const customOpenAI = createOpenAI({
  apiKey: process.env.WIX_API_KEY,
});

const result = await generateText({
  model: customOpenAI('gpt-4o-mini'),
  prompt: 'Explain quantum computing in simple terms.',
});

Usage Examples

Text Generation

import { generateText } from 'ai';
import { openai } from '@wix/ai';

const result = await generateText({
  model: openai('gpt-4o'),
  prompt: 'Write a haiku about programming.',
});

console.log(result.text);
console.log('Tokens used:', result.usage);

Chat Completions

import { generateText } from 'ai';
import { openai } from '@wix/ai';

const result = await generateText({
  model: openai('gpt-4o'),
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'What is TypeScript?' },
  ],
});

console.log(result.text);

TypeScript Support

The package exports comprehensive TypeScript types:

import type {
  OpenAIModelId,
  OpenAIProvider,
  WixAIConfig,
} from '@wix/ai';

const config: WixAIConfig = {
  apiKey: 'your-api-key',
};

const modelId: OpenAIModelId = 'gpt-4o';

Environment Requirements

This package requires:

  • Node.js 18+ or modern browser environment
  • ai package (Vercel AI SDK) as a peer dependency
  • Valid Wix API key or Wix context for authentication

License

MIT

Keywords

wix

FAQs

Package last updated on 11 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts