Libraries (SDK)
Official SDKs to integrate our API into your applications. Choose your preferred programming language and get started in minutes.
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
- JavaScript
- Python
- Go
- Java
- PHP
- Ruby
- C#
- Rust
Installation
npm install @vigrise/sdk
# or
yarn add @vigrise/sdk
# or
pnpm add @vigrise/sdk
Quick Start
import { VigriseClient } from '@vigrise/sdk';
// Initialize the client
const client = new VigriseClient({
apiKey: 'your-api-key-here',
});
// Make your first API call
async 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
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
pip install vigrise
# or
poetry add vigrise
Quick Start
from vigrise import VigriseClient
# Initialize the client
client = VigriseClient(api_key='your-api-key-here')
# Make your first API call
try:
response = client.process(
input='Hello, World!',
options={
'format': 'json'
}
)
print(response.data)
except Exception as error:
print(f'Error: {error}')
Async Support
import asyncio
from 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
go get github.com/vigrise/sdk-go
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
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
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
composer require vigrise/sdk
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 call
try {
$response = $client->process([
'input' => 'Hello, World!',
'options' => [
'format' => 'json'
]
]);
echo $response->data;
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
Installation
gem install vigrise
# or add to Gemfile
gem 'vigrise'
Quick Start
require 'vigrise'
# Initialize the client
client = Vigrise::Client.new(api_key: 'your-api-key-here')
# Make your first API call
begin
response = client.process(
input: 'Hello, World!',
options: {
format: 'json'
}
)
puts response.data
rescue Vigrise::Error => e
puts "Error: #{e.message}"
end
Installation
dotnet add package Vigrise.SDK
# or
Install-Package Vigrise.SDK
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
Add to your Cargo.toml:
[dependencies]
vigrise = "1.0"
tokio = { version = "1", features = ["full"] }
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
All SDKs support multiple authentication methods:
API Key (Recommended)
Pass your API key when initializing the client:
- JavaScript
- Python
- Go
- Java
- PHP
- Ruby
- C#
- Rust
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
Set your API key as an environment variable:
export VIGRISE_API_KEY=your-api-key-here
Then initialize without explicitly passing the key:
- JavaScript
- Python
- Go
- Java
- PHP
- Ruby
- C#
- Rust
const client = new VigriseClient(); // Automatically reads from env
client = VigriseClient() # Automatically reads from env
client := vigrise.NewClient("") // Automatically reads from env
VigriseClient client = new VigriseClient(); // Automatically reads from env
$client = new VigriseClient(); // Automatically reads from env
client = Vigrise::Client.new() # Automatically reads from env
var client = new VigriseClient(); // Automatically reads from env
let client = VigriseClient::from_env(); // Automatically reads from env
Configuration File
Create a configuration file at ~/.vigrise/config.json:
{
"apiKey": "your-api-key-here",
"baseUrl": "https://api.vigrise.com"
}
Common Features
All SDKs provide these core features:
Error Handling
- JavaScript
- Python
- Go
- Java
- PHP
- Ruby
- C#
- Rust
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}"
end
try
{
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
All SDKs include automatic retry with exponential backoff:
- JavaScript
- Python
- Go
- Java
- PHP
- Ruby
- C#
- Rust
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
- JavaScript
- Python
- Go
- Java
- PHP
- Ruby
- C#
- Rust
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
For enterprise or self-hosted deployments:
- JavaScript
- Python
- Go
- Java
- PHP
- Ruby
- C#
- Rust
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
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
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
Configure webhook callbacks for async operations:
await client.process({
input: 'data',
webhook: {
url: 'https://your-domain.com/webhook',
events: ['completed', 'failed'],
},
});
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
All SDKs support testing with mock responses:
import { VigriseClient, mockResponse } from '@vigrise/sdk/testing';
// In your tests
const 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
- 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: support@vigrise.com
Migration Guides
Upgrading from an older version? Check out our migration guides:
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.