🟨

v0studio-js SDK

v2.1.0

Official JavaScript/TypeScript SDK for v0studio AI platform

Installation
Get started with v0studio-js in your JavaScript or TypeScript project

npm

npm install v0studio

yarn

yarn add v0studio

pnpm

pnpm add v0studio

CDN (Browser)

<script src="https://unpkg.com/v0studio@latest/dist/v0studio.min.js"></script>
Quick Start
Get up and running with v0studio in minutes
import { V0Studio } from 'v0studio';

// Initialize the client
const v0 = new V0Studio({
  serverUrl: 'http://localhost:1234',
  apiKey: 'your-api-key' // Optional for local usage
});

// Simple text completion
async function basicCompletion() {
  try {
    const response = await v0.completions.create({
      model: 'llama-3-8b-instruct',
      prompt: 'Explain quantum computing in simple terms:',
      maxTokens: 200,
      temperature: 0.7
    });

    console.log(response.choices[0].text);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

basicCompletion();
📹 Video Tutorials
New!
Learn v0studio-js through comprehensive video tutorials with interactive features
🎬

Comprehensive Video Learning

Interactive video tutorials with code examples, transcripts, and note-taking features

🎯 Interactive Tutorial
Learn by doing with our hands-on coding tutorial
🟨
Getting Started with Text Completion
Learn the basics of generating text with v0studio-js SDK
beginner
10 min
0/3 completed
Progress1 / 3 steps

📹 Video Tutorials

▶️
Introduction to v0studio SDK

5:30

▶️
API Basics Walkthrough

8:15

Step 1: Install and Import

First, let's import the v0studio SDK and set up our client.

📝 Explanation

We import the V0Studio class and create a new client instance pointing to your local v0studio server.

Code Editor
javascript
1

Output

Click "Run Code" to see output...
Step 1 of 3
33% complete
Code Examples
Common use cases and implementation patterns
import { V0Studio } from 'v0studio';

// Initialize the client
const v0 = new V0Studio({
  serverUrl: 'http://localhost:1234',
  apiKey: 'your-api-key' // Optional for local usage
});

// Simple text completion
async function basicCompletion() {
  try {
    const response = await v0.completions.create({
      model: 'llama-3-8b-instruct',
      prompt: 'Explain quantum computing in simple terms:',
      maxTokens: 200,
      temperature: 0.7
    });

    console.log(response.choices[0].text);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

basicCompletion();
API Reference
Complete reference for all SDK methods and options

Core Classes

V0Studio

Main client class

  • • completions
  • • chat
  • • embeddings
  • • models
  • • fineTuning
V0StudioError

Error handling

  • • message
  • • status
  • • code
  • • details

Methods

completions.create(options)

Generate text completions

{ model: string, prompt: string, maxTokens?: number, temperature?: number, stream?: boolean }

chat.completions.create(options)

Create chat completions

{ model: string, messages: Message[], maxTokens?: number, temperature?: number, stream?: boolean }

models.list()

List available models

Returns: Promise<ModelsList>
Configuration
Customize the SDK behavior and connection settings
import { V0Studio } from 'v0studio';

const v0 = new V0Studio({
  serverUrl: 'http://localhost:1234',  // v0studio server URL
  apiKey: 'your-api-key',              // Optional API key
  timeout: 30000,                      // Request timeout (ms)
  retries: 3,                          // Number of retry attempts
  headers: {                           // Additional headers
    'User-Agent': 'my-app/1.0.0'
  },
  proxy: {                             // Proxy settings
    host: 'proxy.example.com',
    port: 8080,
    auth: {
      username: 'user',
      password: 'pass'
    }
  }
});

// Environment variables
// V0STUDIO_SERVER_URL
// V0STUDIO_API_KEY
TypeScript Support
Full TypeScript support with comprehensive type definitions

The v0studio-js SDK includes full TypeScript support with comprehensive type definitions.

import {
  V0Studio,
  CompletionResponse,
  ChatMessage,
  Model,
  FineTuningJob
} from 'v0studio';

const v0 = new V0Studio();

// Typed responses
const completion: CompletionResponse = await v0.completions.create({
  model: 'llama-3-8b-instruct',
  prompt: 'Hello world',
  maxTokens: 100
});

// Typed messages
const messages: ChatMessage[] = [
  { role: 'system', content: 'You are helpful.' },
  { role: 'user', content: 'What is TypeScript?' }
];

// Custom interfaces
interface CustomConfig {
  temperature: number;
  customParameter: string;
}

const config: CustomConfig = {
  temperature: 0.7,
  customParameter: 'value'
};
Troubleshooting
Common issues and their solutions

Connection Issues

If you're having trouble connecting to v0studio:

  • • Ensure v0studio is running on the correct port
  • • Check firewall settings
  • • Verify the server URL in your configuration
  • • Test with curl: curl http://localhost:1234/v1/models

Memory Issues

For large models or long conversations:

  • • Reduce maxTokens for responses
  • • Use streaming for long responses
  • • Unload unused models
  • • Monitor system memory usage

Performance Optimization

Tips for better performance:

  • • Use appropriate model sizes for your hardware
  • • Enable GPU acceleration when available
  • • Batch multiple requests when possible
  • • Cache embeddings for repeated use