VynFi is in early access — some features may be unavailable.

SDKs

Official client libraries for Python, TypeScript, Rust, and .NET

PythonTypeScriptRust.NET
StatusAvailableAvailableAvailableAvailable
Installpip install vynfinpm install vynficargo add vynfidotnet add package VynFi
AsyncYesYes (native)Yes (tokio)Yes (async/await)
TypedType hintsFull TypeScriptStrongly typedStrongly typed
Min RuntimePython 3.9+Node 18+Rust 1.70+.NET 8+

Python SDK

Available

Installation

Bash
pip install vynfi

Authentication

Python
import vynfi
# Initialize with your API key
client = 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

Python
import vynfi
client = vynfi.Client()
# Synchronous quick generation
result = 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 directly
for entry in result.data["journal_entries"][:5]:
print(entry)

Async Generation

Python
import vynfi
client = vynfi.Client()
# Create an async generation job
job = 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 completion
completed_job = client.jobs.wait(job.id, timeout=300)
print(f"Completed! Credits used: {completed_job.credits_used}")

Error Handling

Python
import vynfi
from 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

Python
import hmac
import hashlib
def 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)

Python
# Estimate credits before generating
estimate = client.generate.estimate(
sector="banking",
tables=[{"name": "journal_entries", "rows": 10000}],
options={"anomaly_labels": True},
)
print(f"Estimated credits: {estimate.credits}")

Pagination

Python
# List jobs with pagination
jobs = 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?)Job

Create an async generation job. Returns a Job object with an ID for tracking.

client.generate.quick(sector, tables, format?)GenerationResult

Synchronous quick generation for small datasets (up to 10K rows). Returns data directly.

client.jobs.list(status?, limit?, offset?)JobList

List all generation jobs with optional filtering by status and pagination.

client.jobs.get(job_id)Job

Retrieve details and status of a specific generation job.

client.catalog.list()SectorList

List all available data sectors and their table counts.

client.usage.get()Usage

Get current billing period credit usage and remaining balance.

TypeScript SDK

Available

Installation

Bash
npm install vynfi

Authentication

TypeScript
import VynFi from 'vynfi';
// Initialize with your API key
const client = new VynFi({ apiKey: 'vf_live_abc123...' });
// Or use VYNFI_API_KEY environment variable (recommended)
const client = new VynFi();

Quick Example

TypeScript
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

TypeScript
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

TypeScript
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

Available

Installation

Bash
cargo add vynfi

Authentication

Rust
use vynfi::VynFiClient;
// Initialize with your API key
let client = VynFiClient::new("vf_live_abc123...")?;
// Or use VYNFI_API_KEY environment variable (recommended)
let client = VynFiClient::from_env()?;

Quick Example

Rust
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

Rust
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

Available

Installation

Bash
dotnet add package VynFi

Authentication

csharp
using VynFi;
// Initialize with your API key
var client = new VynFiClient("vf_live_abc123...");
// Or use VYNFI_API_KEY environment variable (recommended)
var client = new VynFiClient();

Quick Example

csharp
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

csharp
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.