Skip to main content

Getting Started

Take your first steps with the SVECTOR API.

The SVECTOR API provides a simple interface to state-of-the-art AI models for text generation, natural language processing, document analysis, and more. This example generates text output from a prompt, as you might using Spec-Chat.

Generate text from a model

curl "https://api.svector.co.in/api/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $SVECTOR_API_KEY" \
-d '{
"model": "spec-3-turbo",
"messages": [
{
"role": "user",
"content": "Write a one-sentence bedtime story about a unicorn."
}
]
}'

Data retention for model responses

Configure your development environment Install and configure the official SVECTOR SDK to run the code above.

Spec-Chat starter app Start building with the Chat Completions API

Text generation and prompting Learn more about prompting, message roles, and building conversational apps.

Analyze document inputs

You can provide document inputs to the model as well. Process PDFs, analyze text files, or extract insights from documents with our RAG capabilities.

Upload and process a document

curl -X POST "https://api.svector.co.in/api/v1/files/" \
-H "Authorization: Bearer $SVECTOR_API_KEY" \
-H "Accept: application/json" \
-F "file=@/path/to/your/document.pdf"

Chat with your document

curl -X POST "https://api.svector.co.in/api/chat/completions" \
-H "Authorization: Bearer $SVECTOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "spec-3-turbo",
"messages": [
{
"role": "user",
"content": "Summarize the key points from this document."
}
],
"files": [
{
"type": "file",
"id": "your-file-id-here"
}
]
}'

Document processing guide Learn to use document inputs and extract insights from files.

Build knowledge collections

Organize multiple documents into knowledge collections for enhanced context and more comprehensive responses.

Create a knowledge collection

curl -X POST "https://api.svector.co.in/api/v1/knowledge/{collection_id}/file/add" \
-H "Authorization: Bearer $SVECTOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file_id": "your-file-id-here"
}'

Query your knowledge collection

curl -X POST "https://api.svector.co.in/api/chat/completions" \
-H "Authorization: Bearer $SVECTOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "spec-3-turbo",
"messages": [
{
"role": "user",
"content": "What are the common themes across these documents?"
}
],
"files": [
{
"type": "collection",
"id": "your-collection-id-here"
}
]
}'

Knowledge collections guide Learn to organize and query multiple documents effectively.

Deliver blazing fast AI experiences

Using server-sent streaming events, you can build high performance, low-latency experiences for your users.

Stream server-sent events from the API

import { SVECTOR } from "svector-sdk";

const client = new SVECTOR({
apiKey: process.env.SVECTOR_API_KEY,
});

const stream = await client.chat.completions.create({
model: "spec-3-turbo",
messages: [
{
role: "user",
content: "Tell me about quantum computing.",
},
],
stream: true,
});

for await (const chunk of stream) {
console.log(chunk.choices[0]?.delta?.content || "");
}

Use streaming events Use server-sent events to stream model responses to users fast.

Use the SDK for better development

Get started quickly with our official JavaScript/TypeScript SDK for Node.js, Deno, or browser environments.

Install the SDK

# For Node.js/npm
npm install svector-sdk

# For Deno/JSR
deno add jsr:@svector/svector

Simple conversation example

import { SVECTOR } from 'svector-sdk';

const client = new SVECTOR({
apiKey: process.env.SVECTOR_API_KEY,
});

const result = await client.conversations.create({
model: 'spec-3-turbo',
instructions: 'You are a helpful AI assistant that explains complex topics clearly.',
input: 'What is artificial intelligence?',
});

console.log(result.output);

SDK documentation Learn how to use the SVECTOR SDK for seamless integration.

Explore further

We've barely scratched the surface of what's possible with the SVECTOR platform. Here are some resources you might want to explore next.

Go deeper with prompting and text generation Learn more about prompting, message roles, and building conversational apps like chat bots.

Process and analyze documents Learn to use document inputs to extract insights and build RAG applications.

Build knowledge-enhanced applications Create applications that leverage your own data and documents for more accurate responses.

Streaming and real-time responses Build responsive applications with streaming capabilities for better user experience.

SDK integration Use our official SDKs for JavaScript, TypeScript, and multiple runtime environments.

Spec-Chat starter app Start building with the Chat Completions API

Full API Reference View the full API reference for the SVECTOR platform.

  • Generate text
  • Process documents
  • Build knowledge collections
  • Stream responses fast
  • Use the SDK
  • Explore further