Libraries (SDK)
Official SDKs to integrate our API into your applications. Choose your preferred programming language and get started in minutes.
Available SDKs
Section titled “Available SDKs”We provide official SDKs for the most popular programming languages:
| Language | Package | Documentation | Repository |
|---|---|---|---|
| JavaScript/TypeScript | @vigrise/sdk | Docs | GitHub |
| Python | vigrise | Docs | GitHub |
| Go | github.com/vigrise/sdk-go | Docs | GitHub |
| Java | com.vigrise:sdk | Docs | GitHub |
| PHP | vigrise/sdk | Docs | GitHub |
| Ruby | vigrise | Docs | GitHub |
| C# | Vigrise.SDK | Docs | GitHub |
| Rust | vigrise | Docs | GitHub |
Installation & Quick Start
Section titled “Installation & Quick Start”Installation
Section titled “Installation”npm install @vigrise/sdk# oryarn add @vigrise/sdk# orpnpm add @vigrise/sdkQuick Start
Section titled “Quick Start”import { VigriseClient } from '@vigrise/sdk';
// Initialize the clientconst client = new VigriseClient({ apiKey: 'your-api-key-here',});
// Make your first API callasync function example() { try { const response = await client.process({ input: 'Hello, World!', options: { format: 'json', }, }); console.log(response.data); } catch (error) { console.error('Error:', error.message); }}
example();TypeScript Support
Section titled “TypeScript Support”The SDK is written in TypeScript and provides full type definitions out of the box.
import { VigriseClient, ProcessOptions, ProcessResponse } from '@vigrise/sdk';
const client = new VigriseClient({ apiKey: process.env.VIGRISE_API_KEY });
const options: ProcessOptions = { input: 'Sample input', format: 'json', timeout: 5000,};
const response: ProcessResponse = await client.process(options);Installation
Section titled “Installation”pip install vigrise# orpoetry add vigriseQuick Start
Section titled “Quick Start”from vigrise import VigriseClient
# Initialize the clientclient = VigriseClient(api_key='your-api-key-here')
# Make your first API calltry: response = client.process( input='Hello, World!', options={ 'format': 'json' } ) print(response.data)except Exception as error: print(f'Error: {error}')Async Support
Section titled “Async Support”import asynciofrom vigrise import AsyncVigriseClient
async def example(): client = AsyncVigriseClient(api_key='your-api-key-here')
response = await client.process( input='Hello, World!', options={'format': 'json'} ) print(response.data)
await client.close()
asyncio.run(example())Installation
Section titled “Installation”go get github.com/vigrise/sdk-goQuick Start
Section titled “Quick Start”package main
import ( "context" "fmt" "log"
vigrise "github.com/vigrise/sdk-go")
func main() { // Initialize the client client := vigrise.NewClient("your-api-key-here")
// Make your first API call ctx := context.Background() response, err := client.Process(ctx, &vigrise.ProcessRequest{ Input: "Hello, World!", Options: &vigrise.ProcessOptions{ Format: "json", }, })
if err != nil { log.Fatal(err) }
fmt.Println(response.Data)}Installation
Section titled “Installation”Maven:
<dependency> <groupId>com.vigrise</groupId> <artifactId>sdk</artifactId> <version>1.0.0</version></dependency>Gradle:
implementation 'com.vigrise:sdk:1.0.0'Quick Start
Section titled “Quick Start”import com.vigrise.VigriseClient;import com.vigrise.models.ProcessRequest;import com.vigrise.models.ProcessResponse;
public class Example { public static void main(String[] args) { // Initialize the client VigriseClient client = new VigriseClient("your-api-key-here");
// Make your first API call try { ProcessRequest request = ProcessRequest.builder() .input("Hello, World!") .format("json") .build();
ProcessResponse response = client.process(request); System.out.println(response.getData()); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } }}Installation
Section titled “Installation”composer require vigrise/sdkQuick Start
Section titled “Quick Start”<?php
require_once 'vendor/autoload.php';
use Vigrise\VigriseClient;
// Initialize the client$client = new VigriseClient('your-api-key-here');
// Make your first API calltry { $response = $client->process([ 'input' => 'Hello, World!', 'options' => [ 'format' => 'json' ] ]);
echo $response->data;} catch (Exception $e) { echo 'Error: ' . $e->getMessage();}Installation
Section titled “Installation”gem install vigrise# or add to Gemfilegem 'vigrise'Quick Start
Section titled “Quick Start”require 'vigrise'
# Initialize the clientclient = Vigrise::Client.new(api_key: 'your-api-key-here')
# Make your first API callbegin response = client.process( input: 'Hello, World!', options: { format: 'json' } ) puts response.datarescue Vigrise::Error => e puts "Error: #{e.message}"endInstallation
Section titled “Installation”dotnet add package Vigrise.SDK# orInstall-Package Vigrise.SDKQuick Start
Section titled “Quick Start”using Vigrise;using System;using System.Threading.Tasks;
class Program{ static async Task Main(string[] args) { // Initialize the client var client = new VigriseClient("your-api-key-here");
// Make your first API call try { var response = await client.ProcessAsync(new ProcessRequest { Input = "Hello, World!", Options = new ProcessOptions { Format = "json" } });
Console.WriteLine(response.Data); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); } }}Installation
Section titled “Installation”Add to your Cargo.toml:
[dependencies]vigrise = "1.0"tokio = { version = "1", features = ["full"] }Quick Start
Section titled “Quick Start”use vigrise::{VigriseClient, ProcessRequest};
#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { // Initialize the client let client = VigriseClient::new("your-api-key-here");
// Make your first API call let request = ProcessRequest { input: "Hello, World!".to_string(), format: Some("json".to_string()), ..Default::default() };
let response = client.process(request).await?; println!("{}", response.data);
Ok(())}Authentication
Section titled “Authentication”All SDKs support multiple authentication methods:
API Key (Recommended)
Section titled “API Key (Recommended)”Pass your API key when initializing the client:
const client = new VigriseClient({ apiKey: 'your-api-key-here' });client = VigriseClient(api_key='your-api-key-here')client := vigrise.NewClient("your-api-key-here")VigriseClient client = new VigriseClient("your-api-key-here");$client = new VigriseClient('your-api-key-here');client = Vigrise::Client.new(api_key: 'your-api-key-here')var client = new VigriseClient("your-api-key-here");let client = VigriseClient::new("your-api-key-here");Environment Variable
Section titled “Environment Variable”Set your API key as an environment variable:
export VIGRISE_API_KEY=your-api-key-hereThen initialize without explicitly passing the key:
const client = new VigriseClient(); // Automatically reads from envclient = VigriseClient() # Automatically reads from envclient := vigrise.NewClient("") // Automatically reads from envVigriseClient client = new VigriseClient(); // Automatically reads from env$client = new VigriseClient(); // Automatically reads from envclient = Vigrise::Client.new() # Automatically reads from envvar client = new VigriseClient(); // Automatically reads from envlet client = VigriseClient::from_env(); // Automatically reads from envConfiguration File
Section titled “Configuration File”Create a configuration file at ~/.vigrise/config.json:
{ "apiKey": "your-api-key-here", "baseUrl": "https://api.vigrise.com"}Common Features
Section titled “Common Features”All SDKs provide these core features:
Error Handling
Section titled “Error Handling”try { const response = await client.process({ input: 'data' });} catch (error) { if (error.code === 'RATE_LIMIT_EXCEEDED') { console.log('Rate limit exceeded, try again later'); } else if (error.code === 'INVALID_API_KEY') { console.log('Invalid API key'); } else { console.log('An error occurred:', error.message); }}try: response = client.process(input='data')except RateLimitError: print('Rate limit exceeded, try again later')except InvalidAPIKeyError: print('Invalid API key')except Exception as error: print(f'An error occurred: {error}')response, err := client.Process(ctx, &vigrise.ProcessRequest{Input: "data"})if err != nil { switch { case errors.Is(err, vigrise.ErrRateLimitExceeded): log.Println("Rate limit exceeded, try again later") case errors.Is(err, vigrise.ErrInvalidAPIKey): log.Println("Invalid API key") default: log.Printf("An error occurred: %v", err) }}try { ProcessResponse response = client.process(request);} catch (RateLimitException e) { System.out.println("Rate limit exceeded, try again later");} catch (InvalidAPIKeyException e) { System.out.println("Invalid API key");} catch (VigriseException e) { System.out.println("An error occurred: " + e.getMessage());}try { $response = $client->process(['input' => 'data']);} catch (RateLimitException $e) { echo 'Rate limit exceeded, try again later';} catch (InvalidAPIKeyException $e) { echo 'Invalid API key';} catch (Exception $e) { echo 'An error occurred: ' . $e->getMessage();}begin response = client.process(input: 'data')rescue Vigrise::RateLimitError puts 'Rate limit exceeded, try again later'rescue Vigrise::InvalidAPIKeyError puts 'Invalid API key'rescue Vigrise::Error => e puts "An error occurred: #{e.message}"endtry{ var response = await client.ProcessAsync(request);}catch (RateLimitException){ Console.WriteLine("Rate limit exceeded, try again later");}catch (InvalidAPIKeyException){ Console.WriteLine("Invalid API key");}catch (VigriseException ex){ Console.WriteLine($"An error occurred: {ex.Message}");}match client.process(request).await { Ok(response) => println!("{}", response.data), Err(VigriseError::RateLimitExceeded) => { println!("Rate limit exceeded, try again later") } Err(VigriseError::InvalidAPIKey) => { println!("Invalid API key") } Err(e) => println!("An error occurred: {}", e),}Retry Logic
Section titled “Retry Logic”All SDKs include automatic retry with exponential backoff:
const client = new VigriseClient({ apiKey: 'your-api-key-here', maxRetries: 3, retryDelay: 1000, // milliseconds});client = VigriseClient( api_key='your-api-key-here', max_retries=3, retry_delay=1.0 # seconds)client := vigrise.NewClient("your-api-key-here", vigrise.WithMaxRetries(3), vigrise.WithRetryDelay(time.Second),)VigriseClient client = VigriseClient.builder() .apiKey("your-api-key-here") .maxRetries(3) .retryDelay(1000) // milliseconds .build();$client = new VigriseClient('your-api-key-here', [ 'max_retries' => 3, 'retry_delay' => 1000, // milliseconds]);client = Vigrise::Client.new( api_key: 'your-api-key-here', max_retries: 3, retry_delay: 1.0 # seconds)var client = new VigriseClient("your-api-key-here", new ClientOptions{ MaxRetries = 3, RetryDelay = TimeSpan.FromSeconds(1)});let client = VigriseClient::builder() .api_key("your-api-key-here") .max_retries(3) .retry_delay(Duration::from_secs(1)) .build();Timeout Configuration
Section titled “Timeout Configuration”const client = new VigriseClient({ apiKey: 'your-api-key-here', timeout: 30000, // 30 seconds});client = VigriseClient( api_key='your-api-key-here', timeout=30.0 # 30 seconds)client := vigrise.NewClient("your-api-key-here", vigrise.WithTimeout(30 * time.Second),)VigriseClient client = VigriseClient.builder() .apiKey("your-api-key-here") .timeout(30000) // 30 seconds .build();$client = new VigriseClient('your-api-key-here', [ 'timeout' => 30.0, // 30 seconds]);client = Vigrise::Client.new( api_key: 'your-api-key-here', timeout: 30 # 30 seconds)var client = new VigriseClient("your-api-key-here", new ClientOptions{ Timeout = TimeSpan.FromSeconds(30)});let client = VigriseClient::builder() .api_key("your-api-key-here") .timeout(Duration::from_secs(30)) .build();Custom Base URL
Section titled “Custom Base URL”For enterprise or self-hosted deployments:
const client = new VigriseClient({ apiKey: 'your-api-key-here', baseUrl: 'https://your-custom-domain.com',});client = VigriseClient( api_key='your-api-key-here', base_url='https://your-custom-domain.com')client := vigrise.NewClient("your-api-key-here", vigrise.WithBaseURL("https://your-custom-domain.com"),)VigriseClient client = VigriseClient.builder() .apiKey("your-api-key-here") .baseUrl("https://your-custom-domain.com") .build();$client = new VigriseClient('your-api-key-here', [ 'base_url' => 'https://your-custom-domain.com',]);client = Vigrise::Client.new( api_key: 'your-api-key-here', base_url: 'https://your-custom-domain.com')var client = new VigriseClient("your-api-key-here", new ClientOptions{ BaseUrl = "https://your-custom-domain.com"});let client = VigriseClient::builder() .api_key("your-api-key-here") .base_url("https://your-custom-domain.com") .build();Advanced Usage
Section titled “Advanced Usage”Batch Processing
Section titled “Batch Processing”Process multiple requests efficiently:
const results = await client.batch([ { input: 'First input' }, { input: 'Second input' }, { input: 'Third input' },]);
results.forEach((result, index) => { console.log(`Result ${index + 1}:`, result.data);});Streaming Responses
Section titled “Streaming Responses”For long-running operations:
const stream = await client.processStream({ input: 'large data' });
stream.on('data', (chunk) => { console.log('Received chunk:', chunk);});
stream.on('end', () => { console.log('Stream completed');});
stream.on('error', (error) => { console.error('Stream error:', error);});Webhooks
Section titled “Webhooks”Configure webhook callbacks for async operations:
await client.process({ input: 'data', webhook: { url: 'https://your-domain.com/webhook', events: ['completed', 'failed'], },});Rate Limiting
Section titled “Rate Limiting”All SDKs automatically handle rate limits and provide rate limit information:
const response = await client.process({ input: 'data' });
console.log('Rate Limit:', response.rateLimit.limit);console.log('Remaining:', response.rateLimit.remaining);console.log('Reset:', new Date(response.rateLimit.reset));Testing
Section titled “Testing”All SDKs support testing with mock responses:
import { VigriseClient, mockResponse } from '@vigrise/sdk/testing';
// In your testsconst client = new VigriseClient({ apiKey: 'test-key' });client.mock(mockResponse({ data: 'mocked data' }));
const response = await client.process({ input: 'test' });expect(response.data).toBe('mocked data');Support
Section titled “Support”- Documentation: https://docs.vigrise.com
- GitHub Issues: Report bugs and request features on the respective SDK repositories
- Community: Join our Discord or Community Forum
- Email Support: [email protected]
Migration Guides
Section titled “Migration Guides”Upgrading from an older version? Check out our migration guides:
Contributing
Section titled “Contributing”We welcome contributions to our SDKs! Each repository has its own contribution guidelines:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
See individual SDK repositories for detailed contribution guidelines.