StripFeed SDKs: TypeScript and Python
·3 min read·StripFeed Team
Official SDKs
StripFeed has official SDKs for the two most popular languages in AI development:
Both are zero-dependency, fully typed, and mirror the same API surface.
TypeScript SDK
Install
npm install stripfeed
Initialize
import StripFeed from "stripfeed";
const sf = new StripFeed("sf_live_your_key");
Fetch a URL
const result = await sf.fetch("https://example.com/article");
console.log(result.markdown); // Clean Markdown content
console.log(result.tokens); // Token count
console.log(result.title); // Page title
console.log(result.url); // Resolved URL
Fetch with Options
const result = await sf.fetch("https://example.com", {
selector: "article.main", // CSS selector (Pro)
format: "json", // Output format (Pro)
maxTokens: 5000, // Truncation limit
ttl: 7200, // Cache TTL in seconds
model: "claude-sonnet-4", // Model for cost tracking
cache: true, // Enable caching (default)
});
Fetch Markdown Only
const markdown = await sf.fetchMarkdown("https://example.com");
// Returns just the Markdown string
Batch Fetch
Process up to 10 URLs in a single request (Pro plan):
const results = await sf.batch([
"https://example.com/page1",
"https://example.com/page2",
{ url: "https://example.com/page3", selector: "article" },
]);
for (const result of results) {
if (result.ok) {
console.log(`${result.url}: ${result.tokens} tokens`);
} else {
console.log(`${result.url}: ${result.error}`);
}
}
Check Usage
const usage = await sf.usage();
console.log(usage.plan); // "free" or "pro"
console.log(usage.requestsUsed); // Requests used this month
console.log(usage.requestsLimit); // Monthly limit
console.log(usage.remaining); // Remaining requests
Error Handling
import StripFeed, { StripFeedError } from "stripfeed";
try {
const result = await sf.fetch("https://example.com");
} catch (err) {
if (err instanceof StripFeedError) {
console.log(err.status); // HTTP status code
console.log(err.message); // Error message
}
}
Python SDK
Install
pip install stripfeed
Initialize
from stripfeed import StripFeed
sf = StripFeed("sf_live_your_key")
Fetch a URL
result = sf.fetch("https://example.com/article")
print(result.markdown) # Clean Markdown content
print(result.tokens) # Token count
print(result.title) # Page title
print(result.url) # Resolved URL
Fetch with Options
result = sf.fetch("https://example.com",
selector="article.main", # CSS selector (Pro)
format="json", # Output format (Pro)
max_tokens=5000, # Truncation limit
ttl=7200, # Cache TTL in seconds
model="claude-sonnet-4", # Model for cost tracking
cache=True, # Enable caching (default)
)
Fetch Markdown Only
markdown = sf.fetch_markdown("https://example.com")
# Returns just the Markdown string
Batch Fetch
results = sf.batch([
"https://example.com/page1",
"https://example.com/page2",
{"url": "https://example.com/page3", "selector": "article"},
])
for result in results:
if result.ok:
print(f"{result.url}: {result.tokens} tokens")
else:
print(f"{result.url}: {result.error}")
Check Usage
usage = sf.usage()
print(usage.plan) # "free" or "pro"
print(usage.requests_used) # Requests used this month
print(usage.requests_limit) # Monthly limit
print(usage.remaining) # Remaining requests
Error Handling
from stripfeed import StripFeed, StripFeedError
try:
result = sf.fetch("https://example.com")
except StripFeedError as err:
print(err.status) # HTTP status code
print(err.message) # Error message
Custom Configuration
sf = StripFeed(
"sf_live_your_key",
base_url="https://www.stripfeed.dev", # Custom base URL
timeout=30, # Request timeout in seconds
)
Requirements
| SDK | Minimum Version | Dependencies |
|---|---|---|
| TypeScript | Node.js 18+ | Zero |
| Python | Python 3.9+ | Zero |
Links
- TypeScript: npm | GitHub
- Python: PyPI | GitHub
- API Docs: stripfeed.dev/docs