storyflo-sdk
v1.0.1
Published
Official TypeScript client for the Storyflo audio news API
Maintainers
Readme
storyflo-sdk
Official TypeScript / Node client for the Storyflo audio news API. Wraps the six agent tools across all three protocols (public REST, OAuth 2.1, x402 micropayments).
npm install storyflo-sdkUsage
import { StoryfloClient } from "storyflo-sdk";
// Public read — no auth, rate-limited per IP.
const sf = new StoryfloClient();
const trending = await sf.searchArticles({ vertical: "tech", limit: 5 });
console.log(trending.articles[0]?.title);
const article = await sf.getArticle(trending.articles[0]!.slug);
console.log(article.body_text);
const audio = await sf.getAudioUrl(article.slug);
console.log(audio.audio_url);OAuth (Claude / ChatGPT agents)
const sf = new StoryfloClient({
auth: { kind: "bearer", token: process.env.STORYFLO_OAUTH_TOKEN! },
});
await sf.subscribeTopic(["tech", "finance"]);
const digest = await sf.digest({ window: "24h", limit: 5 });x402 micropayments (Coinbase AgentKit)
import { StoryfloClient } from "storyflo-sdk";
// `payment` is the base64-encoded EIP-712 authorization the AgentKit
// produces when settling on-chain. Each call costs $0.001-$0.30 USDC.
const sf = new StoryfloClient({
auth: { kind: "x402", payment: x402PaymentHeader },
});
const article = await sf.getArticle("interest-rates-q1");API
| Method | Tool | Auth required |
|-------------------------------|-----------------------|----------------------|
| searchArticles(opts) | search_articles | none / x402 |
| getArticle(slug) | get_article | none / x402 |
| getAudioUrl(slug) | get_audio_url | OAuth / x402 |
| subscribeTopic(verticals) | subscribe_topic | OAuth (write scope) |
| listSubscriptions() | list_subscriptions | OAuth (read scope) |
| digest(opts) | digest | OAuth / x402 |
Errors throw StoryfloError with .status and parsed .body.
License
MIT
