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

@wix/ai

Package Overview
Dependencies
Maintainers
22
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/ai

Wix AI SDK

npmnpm
Version
1.3.0
Version published
Weekly downloads
166
207.41%
Maintainers
22
Weekly downloads
 
Created
Source

@wix/ai

npm version License: MIT TypeScript

Wix AI SDK for the Vercel AI SDK. Provides access to AI models through Wix infrastructure with automatic authentication.

⚠️ Note: This package depends on Vercel AI SDK v6 (currently in beta).

Supported Providers

ProviderStatusCapabilities
OpenAI✅ AvailableText generation, chat, embeddings
Runware🔄 PlannedImage generation

Currently, OpenAI is the only supported provider. Additional providers will be added over time.

Installation

npm install @wix/ai ai@beta

Requirements:

  • ai@>=6.0.0-beta (Vercel AI SDK v6)
  • zod@^4.1.8

Quick Start

Wix Environment (Blocks, Wix CLI Apps)

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

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

Self-Hosted Apps

For apps running outside Wix, pass a WixClient configured with AppStrategy or ApiKeyStrategy:

import { generateText } from 'ai';
import { createOpenAI } from '@wix/ai';
import { createClient, AppStrategy } from '@wix/sdk';

const wixClient = createClient({
  auth: AppStrategy({
    appId: 'YOUR_APP_ID',
    appSecret: 'YOUR_APP_SECRET',
    instanceId: 'YOUR_INSTANCE_ID',
  }),
});

const openai = createOpenAI({ client: wixClient });

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

Requirements

  • ✅ Wix backend code (API routes, server functions)
  • ✅ Self-hosted apps (with WixClient using AppStrategy or ApiKeyStrategy)
  • ❌ Browser/client-side code

Technical requirements:

  • Node.js 18+
  • ai package v6.0.0+

API Reference

OpenAI Provider

Responses API (Default)

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

const { text } = await generateText({
  model: openai('gpt-4o'),
  prompt: 'Explain quantum computing.',
});

Or explicitly:

const model = openai.responses('gpt-4o');

Chat Completions

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

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

Embeddings

import { embed, cosineSimilarity } from 'ai';
import { openai } from '@wix/ai';

const { embedding } = await embed({
  model: openai.embeddingModel('text-embedding-3-small'),
  value: 'Hello world',
});

const similarity = cosineSimilarity(embedding1, embedding2);

Batch embeddings:

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

const { embeddings } = await embedMany({
  model: openai.embeddingModel('text-embedding-3-small'),
  values: ['Hello', 'World', 'Foo', 'Bar'],
});

OpenAI Provider Methods

MethodDescription
openai(modelId)Responses API (default)
openai.responses(modelId)Responses API (explicit)
openai.chat(modelId)Chat Completions API
openai.embeddingModel(modelId)Text embeddings

License

MIT

Keywords

wix

FAQs

Package last updated on 29 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