fluxprotocol-sdk
Universal AI Connectivity - Build connectors in 4 lines. 40% fewer tokens with TOON.
Install
npm install fluxprotocol-sdk
Quick Start
import { connector, method, FluxServer, StdioTransport } from 'fluxprotocol-sdk';
@connector('weather')
class WeatherConnector {
@method()
async getWeather(city: string) {
return { city, temp: 22, desc: 'Sunny' };
}
}
const server = new FluxServer(WeatherConnector);
server.setTransport(new StdioTransport(server));
server.start();
Transports
import { StdioTransport, HttpTransport, WebSocketTransport } from 'fluxprotocol-sdk';
new StdioTransport(server);
new HttpTransport(server, { port: 3000 });
new WebSocketTransport(server, { port: 3001 });
Decorators
import { cache, rateLimit, retry, config } from 'fluxprotocol-sdk';
@method()
@cache({ ttl: 60000, maxSize: 100 })
@rateLimit({ requests: 100, window: '1m' })
@retry({ attempts: 3, backoff: 'exponential' })
async myMethod() { ... }
TOON Format Support
HTTP transport supports TOON format for 40% token reduction:
Accept: application/toon → TOON response
Accept: application/json → JSON response (default)
Related Packages
fluxprotocol-cli - CLI tools
fluxprotocol-client - HTTP/WebSocket client
License
MIT