SDKs
Official client libraries for Python, TypeScript, Rust, and .NET
| Python | TypeScript | Rust | .NET | |
|---|---|---|---|---|
| Status | Available | Available | Available | Available |
| Install | pip install vynfi | npm install vynfi | cargo add vynfi | dotnet add package VynFi |
| Async | Yes | Yes (native) | Yes (tokio) | Yes (async/await) |
| Typed | Type hints | Full TypeScript | Strongly typed | Strongly typed |
| Min Runtime | Python 3.9+ | Node 18+ | Rust 1.70+ | .NET 8+ |
Python SDK
Installation
pip install vynfiAuthentication
import vynfi# Initialize with your API keyclient = vynfi.Client(api_key="vf_live_abc123...")# Or use an environment variable (recommended)# export VYNFI_API_KEY=vf_live_abc123...client = vynfi.Client()Quick Example
import vynficlient = vynfi.Client()# Synchronous quick generationresult = client.generate.quick( sector="banking", tables=[ {"name": "journal_entries", "rows": 1000}, {"name": "chart_of_accounts", "rows": 200}, ], format="json",)print(f"Generated {result.metadata.row_count} rows")print(f"Credits used: {result.credits_used}")# Access the data directlyfor entry in result.data["journal_entries"][:5]: print(entry)Async Generation
import vynficlient = vynfi.Client()# Create an async generation jobjob = client.generate.create( sector="insurance", tables=[ {"name": "claims", "rows": 50000}, {"name": "policies", "rows": 10000}, ], options={ "anomaly_labels": True, "complexity": "complex", },)print(f"Job {job.id} created, status: {job.status}")# Poll for completioncompleted_job = client.jobs.wait(job.id, timeout=300)print(f"Completed! Credits used: {completed_job.credits_used}")Error Handling
import vynfifrom vynfi.exceptions import ( AuthenticationError, InsufficientCreditsError, RateLimitError, VynFiError,)client = vynfi.Client()try: result = client.generate.quick( sector="banking", tables=[{"name": "journal_entries", "rows": 1000}], )except AuthenticationError: print("Invalid or missing API key")except InsufficientCreditsError as e: print(f"Need {e.credits_required}, have {e.credits_available}")except RateLimitError as e: print(f"Rate limited. Retry after {e.retry_after}s")except VynFiError as e: print(f"API error: {e.status} - {e.message}")Webhook Verification
import hmacimport hashlibdef verify_webhook(payload: bytes, signature: str, secret: str) -> bool: expected = hmac.new( secret.encode(), payload, hashlib.sha256 ).hexdigest() return hmac.compare_digest(f"sha256={expected}", signature)Dry Run (Credit Estimation)
# Estimate credits before generatingestimate = client.generate.estimate( sector="banking", tables=[{"name": "journal_entries", "rows": 10000}], options={"anomaly_labels": True},)print(f"Estimated credits: {estimate.credits}")Pagination
# List jobs with paginationjobs = client.jobs.list(status="completed", limit=10, offset=0)for job in jobs: print(f"{job.id}: {job.status} ({job.credits_used} credits)")Python Method Reference
All available methods on the VynFi Python client.
client.generate.create(sector, tables, options?, webhook_url?)JobCreate an async generation job. Returns a Job object with an ID for tracking.
client.generate.quick(sector, tables, format?)GenerationResultSynchronous quick generation for small datasets (up to 10K rows). Returns data directly.
client.jobs.list(status?, limit?, offset?)JobListList all generation jobs with optional filtering by status and pagination.
client.jobs.get(job_id)JobRetrieve details and status of a specific generation job.
client.catalog.list()SectorListList all available data sectors and their table counts.
client.usage.get()UsageGet current billing period credit usage and remaining balance.
TypeScript SDK
Installation
npm install vynfiAuthentication
import VynFi from 'vynfi';// Initialize with your API keyconst client = new VynFi({ apiKey: 'vf_live_abc123...' });// Or use VYNFI_API_KEY environment variable (recommended)const client = new VynFi();Quick Example
const result = await client.generate.quick({ sector: 'banking', tables: [{ name: 'journal_entries', rows: 1000 }], format: 'json',});console.log(`Generated ${result.metadata.rowCount} rows`);console.log(`Credits used: ${result.creditsUsed}`);Async Generation
const job = await client.generate.create({ sector: 'insurance', tables: [ { name: 'claims', rows: 50000 }, { name: 'policies', rows: 10000 }, ], options: { anomalyLabels: true },});const completed = await client.jobs.wait(job.id, { timeout: 300 });console.log(`Credits used: ${completed.creditsUsed}`);Error Handling
import { VynFiError, RateLimitError, InsufficientCreditsError } from 'vynfi';try { const result = await client.generate.quick({ /* ... */ });} catch (err) { if (err instanceof RateLimitError) { console.log(`Retry after ${err.retryAfter}s`); } else if (err instanceof InsufficientCreditsError) { console.log(`Need ${err.creditsRequired}, have ${err.creditsAvailable}`); } else if (err instanceof VynFiError) { console.log(`API error: ${err.status} - ${err.message}`); }}TypeScript Method Reference
All available methods on the VynFi TypeScript client.
client.generate.create(options)Promise<Job>Create an async generation job.
client.generate.quick(options)Promise<GenerationResult>Synchronous generation for small datasets.
client.generate.estimate(options)Promise<CreditEstimate>Estimate credits without generating.
client.jobs.list(options?)Promise<Job[]>List jobs with optional filtering.
client.jobs.get(jobId)Promise<Job>Get job details.
client.jobs.wait(jobId, options?)Promise<Job>Poll until job completes.
client.catalog.list()Promise<Sector[]>List available sectors.
client.usage.get()Promise<Usage>Get current period usage.
Rust SDK
Installation
cargo add vynfiAuthentication
use vynfi::VynFiClient;// Initialize with your API keylet client = VynFiClient::new("vf_live_abc123...")?;// Or use VYNFI_API_KEY environment variable (recommended)let client = VynFiClient::from_env()?;Quick Example
use vynfi::{VynFiClient, GenerateRequest, Table};let client = VynFiClient::from_env()?;let result = client.generate().quick(&GenerateRequest { sector: "banking".into(), tables: vec![ Table { name: "journal_entries".into(), rows: 1000 }, ], format: Some("json".into()), ..Default::default()}).await?;println!("Generated {} rows", result.metadata.row_count);println!("Credits used: {}", result.credits_used);Error Handling
use vynfi::errors::{VynFiError, ApiErrorKind};match client.generate().quick(&req).await { Ok(result) => println!("Success: {} rows", result.metadata.row_count), Err(VynFiError::Api { kind: ApiErrorKind::RateLimit { retry_after }, .. }) => { println!("Rate limited, retry after {retry_after}s"); } Err(VynFiError::Api { kind: ApiErrorKind::InsufficientCredits, .. }) => { println!("Not enough credits"); } Err(e) => eprintln!("Error: {e}"),}.NET SDK
Installation
dotnet add package VynFiAuthentication
using VynFi;// Initialize with your API keyvar client = new VynFiClient("vf_live_abc123...");// Or use VYNFI_API_KEY environment variable (recommended)var client = new VynFiClient();Quick Example
using VynFi;var client = new VynFiClient();var result = await client.Generate.QuickAsync(new GenerateRequest{ Sector = "banking", Tables = new[] { new TableSpec("journal_entries", 1000) }, Format = "json",});Console.WriteLine($"Generated {result.Metadata.RowCount} rows");Console.WriteLine($"Credits used: {result.CreditsUsed}");Error Handling
using VynFi;using VynFi.Exceptions;try{ var result = await client.Generate.QuickAsync(request);}catch (RateLimitException ex){ Console.WriteLine($"Retry after {ex.RetryAfter}s");}catch (InsufficientCreditsException ex){ Console.WriteLine($"Need {ex.CreditsRequired}, have {ex.CreditsAvailable}");}catch (VynFiException ex){ Console.WriteLine($"API error: {ex.StatusCode} - {ex.Message}");}Common Patterns
Best practices that apply across all SDKs.
Retry with Backoff
All SDKs include built-in retry with exponential backoff for transient errors (5xx, 429). Configure max retries via client options.
Webhook Verification
Always verify webhook signatures using HMAC-SHA256 before processing events. Never trust unverified payloads.
Credit Estimation
Use client.generate.estimate() to preview credit cost before committing to a generation job. Supports the dry_run parameter.
Environment Keys
Use vf_test_ keys in development and CI/CD (zero credits, mock data). Switch to vf_live_ in production via environment variables.
All SDKs are thin wrappers around the VynFi REST API. Anything you can do with curl, you can do with any SDK.