replicate-javascript  by replicate

Node.js client for Replicate's API

created 2 years ago
561 stars

Top 58.2% on sourcepulse

GitHubView on GitHub
Project Summary

This Node.js client library provides a programmatic interface for interacting with the Replicate API, enabling developers to run machine learning models directly from their JavaScript or TypeScript applications. It simplifies the process of integrating complex AI models into backend services, serverless functions, or command-line tools.

How It Works

The client leverages Replicate's HTTP API to manage model execution. It abstracts away the complexities of API requests, authentication, and handling model inputs/outputs. Key features include synchronous (run) and asynchronous (stream) model execution, webhook support for real-time updates, and utilities for managing models, predictions, and file uploads. The run method is optimized for low-latency file models, while stream allows for real-time output processing.

Quick Start & Requirements

  • Installation: npm install replicate
  • Requirements: Node.js >= 18, Bun >= 1.0, or Deno >= 1.28. Compatible with serverless platforms like Cloudflare Workers, Vercel functions, and AWS Lambda.
  • Usage: Import and instantiate the client with an API token, then use replicate.run() or replicate.stream() with model identifiers and input parameters.
  • Docs: https://github.com/replicate/replicate-javascript

Highlighted Details

  • Supports running models with file inputs (URLs or local file handles).
  • Provides robust webhook functionality for asynchronous event handling.
  • Includes TypeScript definitions for enhanced developer experience.
  • Offers methods for model discovery, prediction management, and file uploads.

Maintenance & Community

The library is maintained by Replicate. Further community engagement details are not explicitly provided in the README.

Licensing & Compatibility

The library is released under the MIT License, allowing for broad commercial use and integration with closed-source projects.

Limitations & Caveats

The client cannot interact directly with the Replicate API from a browser environment. For web applications, a server-side approach or a separate client-side guide is recommended. Node.js versions prior to 18 may require a polyfill for fetch.

Health Check
Last commit

2 months ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
0
Star History
16 stars in the last 90 days

Explore Similar Projects

Starred by Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers) and Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera).

client-python by mistralai

0.3%
628
Python SDK for Mistral AI platform
created 1 year ago
updated 1 week ago
Starred by Adam Wolff Adam Wolff(Claude Code Core; MTS at Anthropic), Samuel Colvin Samuel Colvin(Author of Pydantic, Pydantic Logfire, PydanticAI), and
3 more.

anthropic-sdk-python by anthropics

0.7%
2k
Python SDK for Anthropic's REST API
created 2 years ago
updated 23 hours ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Daniel Han Daniel Han(Cofounder of Unsloth), and
1 more.

airweave by airweave-ai

0.6%
3k
Semantic MCP server for AI agents
created 7 months ago
updated 2 days ago
Feedback? Help us improve.