Vision SDK Overview
AI-powered image analysis and manipulation with @coreviz/sdk
Vision SDK
The @coreviz/sdk npm package gives you access to CoreViz's AI vision capabilities — describing, tagging, editing, generating, and embedding images — directly from your JavaScript, TypeScript, or React Native application.
Installation
npm install @coreviz/sdkReact Native / Expo
npx expo install expo-image-manipulator expo-file-systemReact Native limitation
Local mode (mode: 'local') for tag() and embed() is not supported on React Native / Expo.
Setup
import { CoreViz } from '@coreviz/sdk';
const sdk = new CoreViz({
apiKey: process.env.COREVIZ_API_KEY
});Available Methods
describe()
Generate a detailed text description or caption for any image URL or base64 string.
tag()
Classify images with custom prompts and option lists. Supports both API and local in-browser processing.
embed() + similarity()
Generate CLIP embeddings for images or text, then compute cosine similarity for semantic search.
edit() + generate()
Edit images with natural language prompts, or generate new images from text descriptions.
Quick Start
import { CoreViz } from '@coreviz/sdk';
const sdk = new CoreViz({ apiKey: process.env.COREVIZ_API_KEY });
// Describe an image
const description = await sdk.describe('https://example.com/photo.jpg');
console.log(description); // "A red sports car parked on a cobblestone street..."
// Tag / classify
const { tags } = await sdk.tag('https://example.com/photo.jpg', {
prompt: 'What type of vehicle is this?',
options: ['car', 'truck', 'motorcycle', 'bus'],
multiple: false,
});
console.log(tags); // ["car"]
// Generate embeddings for semantic search
const { embedding } = await sdk.embed('https://example.com/photo.jpg', { type: 'image' });
const { embedding: queryEmbed } = await sdk.embed('red sports car', { type: 'text' });
const score = sdk.similarity(embedding, queryEmbed);
console.log(score); // 0.82
// Edit an image
const editedUrl = await sdk.edit('https://example.com/photo.jpg', {
prompt: 'Make it look like a watercolor painting',
aspectRatio: '1:1',
});Authentication
All methods require an API key. Get yours from Your Account → API Keys on lab.coreviz.io.
// Via constructor
const sdk = new CoreViz({ apiKey: 'your_api_key' });
// Or for users authenticated via coreviz login
const sdk = new CoreViz({ token: 'session_token' });Supported Image Inputs
All vision methods accept:
- URL — publicly accessible HTTPS URL
- Base64 — data URI string (for local files)
// URL
await sdk.describe('https://cdn.example.com/photo.jpg');
// Base64
const base64 = await fileToBase64(file);
await sdk.describe(base64);
// Auto-resize before sending (saves bandwidth)
const resized = await sdk.resize(file, 1920, 1080);
await sdk.describe(resized);resize()
Resize images client-side or server-side before processing to reduce bandwidth and improve speed.
const resized = await sdk.resize(imageFileOrUrl, 800, 600);
// or as a standalone import:
import { resize } from '@coreviz/sdk';Also available as a standalone export for use without creating a CoreViz instance.
Raw API Reference
If you prefer to call the HTTP endpoints directly, see the Vision API Reference.