Skip to content
RSFlowHub
Developer docs API v1 Stable OpenAPI SDKs Playground
Official SDKs: PHP, Node.js / TypeScript & Python

Official SDKs: PHP, Node.js & Python

Install one package, set your API key and call any RSFlowHub API in a few lines. The SDKs handle authentication, errors, retries and file uploads, and they keep working when new APIs are released.

Direct System Definition: RSFlowHub SDKs

RSFlowHub has official open-source SDKs for PHP (composer require rsflowhub/rsflowhub-php), Node.js and TypeScript (npm install rsflowhub) and Python (pip install rsflowhub). Each SDK reads your key from RSFLOWHUB_API_KEY, calls the REST API at /api/v1, returns the same {success, request_id, data, meta} envelope, raises typed errors by error code and retries 429 and 5xx answers. Methods are named after the endpoint, so a new API works without upgrading the SDK.

Choose your language

LanguagePackageWorks withGuideSource
PHP 8.1+ rsflowhub/rsflowhub-php Laravel (auto-discovered facade), Symfony, WordPress, any PHP app PHP guide GitHub
Node.js / TypeScript 18+ rsflowhub Next.js, Express, NestJS, Nuxt, SvelteKit, Bun, Deno, Cloudflare Workers, Vercel Edge JavaScript guide GitHub
Python 3.9+ rsflowhub Django, FastAPI, Flask, Celery, scripts and notebooks (sync and async clients) Python guide GitHub

1. Install

terminal
composer require rsflowhub/rsflowhub-php
npm install rsflowhub
# or: yarn add rsflowhub · pnpm add rsflowhub · bun add rsflowhub
pip install rsflowhub
# or: poetry add rsflowhub · uv add rsflowhub

2. Set your API key

Create a key in your dashboard and put it in an environment variable. Every SDK reads RSFLOWHUB_API_KEY automatically, so the key stays out of your code. See Authentication & API keys.

.env
RSFLOWHUB_API_KEY=rfh_your_api_key
Keep the key on your server
Your API key spends your credits, and anything in browser or mobile app code is public. Call RSFlowHub from your backend (a Next.js route handler or server action, Laravel, Express, Django, FastAPI) and have your frontend call that. The Node.js SDK refuses to start in a browser unless you explicitly allow it.

3. Make your first call

AI endpoints put their output in data.result. Each SDK gives you that directly: $res->result('key') in PHP, res.result in Node.js and Python. The request id is always there for support.

sentiment.php
<?php

require 'vendor/autoload.php';

use RSFlowHub\RSFlowHub;

$client = new RSFlowHub();   // reads RSFLOWHUB_API_KEY, or new RSFlowHub('rfh_...')

$res = $client->ai->sentimentAnalysis([
    'text' => 'Setup took two minutes and support answered right away.',
]);

echo $res->result('sentiment');   // "positive"
echo $res->requestId;             // "req_..." quote it when you contact support
import { RSFlowHub } from 'rsflowhub';

const client = new RSFlowHub();   // reads RSFLOWHUB_API_KEY, or { apiKey: 'rfh_...' }

const res = await client.ai.sentimentAnalysis({
  text: 'Setup took two minutes and support answered right away.',
});

console.log(res.result.sentiment);  // "positive"
console.log(res.requestId);         // "req_..." quote it when you contact support
from rsflowhub import RSFlowHub

client = RSFlowHub()  # reads RSFLOWHUB_API_KEY, or RSFlowHub(api_key="rfh_...")

res = client.ai.sentiment_analysis(
    text="Setup took two minutes and support answered right away.",
)

print(res.result["sentiment"])  # "positive"
print(res.request_id)           # "req_..." quote it when you contact support

How methods are named

A method is the endpoint's URL name in the style of each language. Every API in the API reference works this way, including APIs released after you installed the SDK.

EndpointPHPNode.js / TypeScriptPython
POST /ai/sentiment-analysis $client->ai->sentimentAnalysis([...]) client.ai.sentimentAnalysis({...}) client.ai.sentiment_analysis(...)
POST /ai/translation $client->ai->translation([...]) client.ai.translation({...}) client.ai.translation(...)
POST /ai/pii-redaction $client->ai->piiRedaction([...]) client.ai.piiRedaction({...}) client.ai.pii_redaction(...)
POST /knowledge-bases/{id}/ask $client->knowledgeBases->ask($id, [...]) client.knowledgeBases.ask(id, {...}) client.knowledge_bases.ask(id, ...)
POST /chatbots/{id}/messages $client->chatbots->sendMessage($id, [...]) client.chatbots.sendMessage(id, {...}) client.chatbots.send_message(id, ...)
Any other route $client->request('GET', '/account/usage') client.request('GET', '/account/usage') client.request("GET", "/account/usage")

Ids in the URL come first, then the request body. Every method also has typed parameters for autocomplete in your editor; the full list is in each repository's docs/ENDPOINTS.md.

Language guides

Each guide covers the response object, path ids and file uploads, knowledge bases and chatbots, every error class, options, retries and framework examples for that language.

All SDKs retry 429, 502, 503 and 504 answers with backoff (never charged) and turn every other API error into a typed exception with the error code, message and request id. Limits and credits: Rate limits & credits.

Why the SDKs never go out of date

  • Methods are not hard-coded. An AI endpoint is called by its name, so a new API works the day it ships.
  • New routes are looked up live. Any other method the SDK does not know yet is found in the public OpenAPI document the first time you call it.
  • Types are regenerated weekly. Autocomplete and reference docs are rebuilt from the same OpenAPI document, so upgrading only adds editor hints.
Prefer raw HTTP or another language?
The OpenAPI document (/api/v1/openapi.json) describes every request and response. Import it into Postman or Insomnia, or generate a client for Go, Java, C# or Ruby with any OpenAPI generator. More examples are in the examples repository.

SDK Questions

Yes. Install rsflowhub/rsflowhub-php with Composer, rsflowhub from npm for Node.js and TypeScript, or rsflowhub from PyPI for Python. All three are open source (MIT), call the same REST API and return the same response envelope.

No. SDK methods are not hard-coded: a new AI endpoint is called by its name right away, for example client.ai.newEndpoint() in Node.js. Other new routes are looked up in the public OpenAPI document the first time you call them. Updating the SDK only adds autocomplete and docs for the new methods.

Use it on your server, not in browser code. Your API key spends your credits and anything in the browser is public, so the SDK refuses to start in a browser by default. Call RSFlowHub from a Next.js route handler, server action, Express or another backend, and fetch that from your components.

Yes. They retry 429, 502, 503 and 504 answers and network errors with backoff, respecting the Retry-After header (2 retries by default). Those answers are never charged. Validation and authentication errors are not retried, because the same request would fail again.

Yes. The SDKs are a convenience over the REST API: any HTTP client works with your API key in the X-API-Key header. Every request and response is described in the public OpenAPI document at /api/v1/openapi.json.

Ready to build?

Create your free account and make your first API call in minutes.

RSFlowHub

Sign in to continue

You'll come straight back to this page.

Forgot password?

New to RSFlowHub? Create a free account