SDKs & Libraries

JavaScript/TypeScript SDK, Python SDK, Go SDK (coming soon), AWS S3 SDK compatibility, installation and usage examples.

NFYio provides official SDKs and supports the AWS S3 SDK for storage. Use the SDK that matches your stack for type safety, retries, and simplified API calls.

JavaScript / TypeScript SDK

The official NFYio SDK for Node.js and browsers.

Installation

npm install @nfyio/sdk
# or
pnpm add @nfyio/sdk
# or
yarn add @nfyio/sdk

Configuration

import { NfyioClient } from '@nfyio/sdk';

const client = new NfyioClient({
  apiUrl: 'https://api.yourdomain.com',
  storageUrl: 'https://storage.yourdomain.com',
  apiKey: process.env.NFYIO_API_KEY!,
});

Storage (Buckets & Objects)

// List buckets
const buckets = await client.storage.listBuckets();

// Create bucket
await client.storage.createBucket('my-bucket');

// Upload object
await client.storage.putObject('my-bucket', 'path/file.txt', fileBuffer, {
  contentType: 'text/plain',
});

// Download object
const { body } = await client.storage.getObject('my-bucket', 'path/file.txt');
const text = await body?.transformToString();

// Presigned URL
const url = await client.storage.getPresignedUrl('my-bucket', 'path/file.pdf', {
  method: 'GET',
  expiresIn: 3600,
});

Agents (RAG & Chat)

// Create agent
const agent = await client.agents.create({
  name: 'docs-assistant',
  model: 'gpt-4o-mini',
  bucket_id: 'bucket_abc123',
  embedding_paths: ['/docs/**'],
});

// Chat (non-streaming)
const response = await client.agents.chat(agent.id, {
  message: 'What is our refund policy?',
  thread_id: 'thread_abc123',
});

// Chat (streaming)
const stream = await client.agents.chatStream(agent.id, {
  message: 'Summarize the key points.',
  thread_id: 'thread_abc123',
});

for await (const chunk of stream) {
  process.stdout.write(chunk.content);
}

Networking

// List VPCs
const vpcs = await client.networking.listVpcs();

// Create VPC
const vpc = await client.networking.createVpc({
  name: 'production-vpc',
  cidr_block: '10.0.0.0/16',
  availability_zones: ['us-east-1a', 'us-east-1b'],
});

Python SDK

Official Python client for NFYio.

Installation

pip install nfyio-sdk

Configuration

from nfyio import NfyioClient

client = NfyioClient(
    api_url="https://api.yourdomain.com",
    storage_url="https://storage.yourdomain.com",
    api_key=os.environ["NFYIO_API_KEY"],
)

Storage

# List buckets
buckets = client.storage.list_buckets()

# Upload object
with open("file.txt", "rb") as f:
    client.storage.put_object("my-bucket", "path/file.txt", f)

# Download object
content = client.storage.get_object("my-bucket", "path/file.txt")

# Presigned URL
url = client.storage.get_presigned_url(
    "my-bucket", "path/file.pdf", method="GET", expires_in=3600
)

Agents

# Chat
response = client.agents.chat(
    agent_id="agent_xyz789",
    message="What is our refund policy?",
    thread_id="thread_abc123",
)

# Streaming
for chunk in client.agents.chat_stream(
    agent_id="agent_xyz789",
    message="Summarize the key points.",
    thread_id="thread_abc123",
):
    print(chunk.content, end="")

Go SDK (Coming Soon)

A Go SDK is planned. For now, use the REST API directly or the AWS S3 SDK for storage.

// Planned API (subject to change)
// client, err := nfyio.NewClient(nfyio.Config{
//     APIURL:    "https://api.yourdomain.com",
//     StorageURL: "https://storage.yourdomain.com",
//     APIKey:    os.Getenv("NFYIO_API_KEY"),
// })

AWS S3 SDK Compatibility

NFYio storage is S3-compatible. Use the AWS SDK for S3 with your NFYio endpoint and credentials.

JavaScript (AWS SDK v3)

npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
const { S3Client, ListBucketsCommand, PutObjectCommand } = require('@aws-sdk/client-s3');
const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');
const { GetObjectCommand } = require('@aws-sdk/client-s3');

const s3 = new S3Client({
  region: 'us-east-1',
  endpoint: 'https://storage.yourdomain.com',
  credentials: {
    accessKeyId: process.env.NFYIO_ACCESS_KEY_ID,
    secretAccessKey: process.env.NFYIO_SECRET_ACCESS_KEY,
  },
  forcePathStyle: true,
});

// List buckets
const { Buckets } = await s3.send(new ListBucketsCommand({}));

// Upload
await s3.send(new PutObjectCommand({
  Bucket: 'my-bucket',
  Key: 'path/file.txt',
  Body: 'Hello, NFYio!',
  ContentType: 'text/plain',
}));

// Presigned URL
const url = await getSignedUrl(s3, new GetObjectCommand({
  Bucket: 'my-bucket',
  Key: 'path/file.pdf',
}), { expiresIn: 3600 });

Python (boto3)

pip install boto3
import boto3
from botocore.config import Config

s3 = boto3.client(
    's3',
    endpoint_url='https://storage.yourdomain.com',
    aws_access_key_id=os.environ['NFYIO_ACCESS_KEY_ID'],
    aws_secret_access_key=os.environ['NFYIO_SECRET_ACCESS_KEY'],
    region_name='us-east-1',
    config=Config(signature_version='s3v4'),
)

# List buckets
buckets = s3.list_buckets()

# Upload
s3.put_object(
    Bucket='my-bucket',
    Key='path/file.txt',
    Body=b'Hello, NFYio!',
    ContentType='text/plain',
)

# Presigned URL
url = s3.generate_presigned_url(
    'get_object',
    Params={'Bucket': 'my-bucket', 'Key': 'path/file.pdf'},
    ExpiresIn=3600,
)

AWS CLI

# Configure profile
aws configure set aws_access_key_id $NFYIO_ACCESS_KEY_ID --profile nfyio
aws configure set aws_secret_access_key $NFYIO_SECRET_ACCESS_KEY --profile nfyio

# Use with endpoint
aws s3 ls --endpoint-url https://storage.yourdomain.com --profile nfyio
aws s3 cp file.txt s3://my-bucket/ --endpoint-url https://storage.yourdomain.com --profile nfyio

Comparison

FeatureNFYio SDKAWS S3 SDK
Storage
Agents (RAG)
Networking
TypeScript types
Presigned URLs
Multipart upload

Use the NFYio SDK for agents and networking. Use AWS S3 SDK if you already have S3 integration or need language support (e.g., Go) before the NFYio Go SDK is available.

Next Steps