Update README with unified search and TypeScript client
- Document unified search with --provider flag (civitai, hf, all) - Add /api/search to server endpoints - Add TypeScript client section (@saiden/tensors) - Add public API info (tensors-api.saiden.dev) - Update search options table with provider column Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,13 +44,21 @@ pip install tensors[server]
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Search CivitAI
|
### Search Models
|
||||||
|
|
||||||
|
Search across CivitAI and Hugging Face with a unified interface.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Search by query
|
# Search both CivitAI and Hugging Face (default)
|
||||||
tsr search "illustrious"
|
tsr search "flux lora"
|
||||||
|
|
||||||
# Filter by type and base model
|
# Search CivitAI only
|
||||||
|
tsr search "illustrious" -P civitai
|
||||||
|
|
||||||
|
# Search Hugging Face only
|
||||||
|
tsr search "flux" -P hf
|
||||||
|
|
||||||
|
# Filter by type and base model (CivitAI)
|
||||||
tsr search -t lora -b sdxl
|
tsr search -t lora -b sdxl
|
||||||
|
|
||||||
# Sort by newest, limit results
|
# Sort by newest, limit results
|
||||||
@@ -59,11 +67,15 @@ tsr search -t checkpoint -s newest -n 10
|
|||||||
# Filter by tag and period
|
# Filter by tag and period
|
||||||
tsr search --tag anime -p week -b illustrious
|
tsr search --tag anime -p week -b illustrious
|
||||||
|
|
||||||
# By creator
|
# By creator/author
|
||||||
tsr search -u "username"
|
tsr search -u "username" # CivitAI
|
||||||
|
tsr search -a "stabilityai" -P hf # Hugging Face
|
||||||
|
|
||||||
# SFW only with commercial use filter
|
# SFW only with commercial use filter
|
||||||
tsr search --sfw --commercial sell
|
tsr search --sfw --commercial sell
|
||||||
|
|
||||||
|
# Hugging Face pipeline filter
|
||||||
|
tsr search --pipeline text-to-image -P hf
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get Model Info
|
### Get Model Info
|
||||||
@@ -94,15 +106,9 @@ tsr dl -m 12345 -o ./models
|
|||||||
|
|
||||||
### Hugging Face Integration
|
### Hugging Face Integration
|
||||||
|
|
||||||
Search and download safetensor files from Hugging Face Hub.
|
Get info and download safetensor files from Hugging Face Hub.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Search for models with safetensor files
|
|
||||||
tsr hf search "flux"
|
|
||||||
|
|
||||||
# Filter by author or pipeline
|
|
||||||
tsr hf search -a stabilityai -p text-to-image
|
|
||||||
|
|
||||||
# Get model info and list safetensor files
|
# Get model info and list safetensor files
|
||||||
tsr hf get black-forest-labs/FLUX.1-schnell
|
tsr hf get black-forest-labs/FLUX.1-schnell
|
||||||
|
|
||||||
@@ -116,6 +122,8 @@ tsr hf dl black-forest-labs/FLUX.1-schnell -f ae.safetensors
|
|||||||
tsr hf dl author/model --all -o ./models
|
tsr hf dl author/model --all -o ./models
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** For searching Hugging Face, use `tsr search -P hf "query"` (see [Search Models](#search-models)).
|
||||||
|
|
||||||
### Inspect Local Files
|
### Inspect Local Files
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -303,28 +311,27 @@ Data is stored in XDG-compliant paths:
|
|||||||
|
|
||||||
## Search Options
|
## Search Options
|
||||||
|
|
||||||
| Option | Values |
|
| Option | Values | Provider |
|
||||||
|--------|--------|
|
|--------|--------|----------|
|
||||||
| `-t, --type` | checkpoint, lora, embedding, vae, controlnet, locon |
|
| `-P, --provider` | civitai, hf, all (default: all) | Both |
|
||||||
| `-b, --base` | sd14, sd15, sd2, sdxl, pony, flux, illustrious, noobai, auraflow |
|
| `-t, --type` | checkpoint, lora, embedding, vae, controlnet, locon | CivitAI |
|
||||||
| `-s, --sort` | downloads, rating, newest |
|
| `-b, --base` | sd14, sd15, sd2, sdxl, pony, flux, illustrious, noobai, auraflow | CivitAI |
|
||||||
| `-n, --limit` | Number of results (default: 25) |
|
| `-s, --sort` | downloads, rating, newest | Both |
|
||||||
| `-p, --period` | all, year, month, week, day |
|
| `-n, --limit` | Number of results (default: 25) | Both |
|
||||||
| `--tag` | Filter by tag (e.g., "anime") |
|
| `-p, --period` | all, year, month, week, day | CivitAI |
|
||||||
| `-u, --user` | Filter by creator username |
|
| `--tag` | Filter by tag (e.g., "anime") | Both |
|
||||||
| `--nsfw` | none, soft, mature, x |
|
| `-u, --user` | Filter by creator username | CivitAI |
|
||||||
| `--sfw` | Exclude NSFW content |
|
| `-a, --author` | Filter by author/organization | HuggingFace |
|
||||||
| `--commercial` | none, image, rent, sell |
|
| `--pipeline` | Pipeline tag (text-to-image, etc.) | HuggingFace |
|
||||||
| `--page` | Page number for pagination |
|
| `--nsfw` | none, soft, mature, x | CivitAI |
|
||||||
|
| `--sfw` | Exclude NSFW content | CivitAI |
|
||||||
|
| `--commercial` | none, image, rent, sell | CivitAI |
|
||||||
|
| `--page` | Page number for pagination | CivitAI |
|
||||||
|
|
||||||
## Hugging Face Options
|
## Hugging Face Download Options
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
|--------|-------------|
|
|--------|-------------|
|
||||||
| `-a, --author` | Filter by author/organization |
|
|
||||||
| `-p, --pipeline` | Pipeline tag (text-to-image, text-generation, etc.) |
|
|
||||||
| `-s, --sort` | Sort by (downloads, likes, created_at, trending_score) |
|
|
||||||
| `-n, --limit` | Number of results (default: 25) |
|
|
||||||
| `-f, --file` | Specific file to download |
|
| `-f, --file` | Specific file to download |
|
||||||
| `--all` | Download all safetensor files |
|
| `--all` | Download all safetensor files |
|
||||||
| `-o, --output` | Output directory |
|
| `-o, --output` | Output directory |
|
||||||
@@ -361,6 +368,7 @@ When running `tsr serve`, the following endpoints are available:
|
|||||||
| `/status` | GET | Server status (public) |
|
| `/status` | GET | Server status (public) |
|
||||||
| `/docs` | GET | OpenAPI documentation (public) |
|
| `/docs` | GET | OpenAPI documentation (public) |
|
||||||
| `/reload` | POST | Hot-reload with new model |
|
| `/reload` | POST | Hot-reload with new model |
|
||||||
|
| `/api/search` | GET | Unified search (CivitAI + HuggingFace) |
|
||||||
| `/api/images` | GET | List gallery images |
|
| `/api/images` | GET | List gallery images |
|
||||||
| `/api/images/{id}` | GET | Get image file |
|
| `/api/images/{id}` | GET | Get image file |
|
||||||
| `/api/images/{id}/meta` | GET | Get image metadata |
|
| `/api/images/{id}/meta` | GET | Get image metadata |
|
||||||
@@ -378,6 +386,37 @@ When running `tsr serve`, the following endpoints are available:
|
|||||||
|
|
||||||
All sd-server endpoints (`/sdapi/v1/*`) are proxied through to the underlying process.
|
All sd-server endpoints (`/sdapi/v1/*`) are proxied through to the underlying process.
|
||||||
|
|
||||||
|
## Public API
|
||||||
|
|
||||||
|
A public API is available at `https://tensors-api.saiden.dev`. Authentication required via `X-API-Key` header.
|
||||||
|
|
||||||
|
## TypeScript Client
|
||||||
|
|
||||||
|
A TypeScript client is available for the server API:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @saiden/tensors
|
||||||
|
```
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Configuration, SearchApi, CivitAIApi } from '@saiden/tensors'
|
||||||
|
|
||||||
|
const config = new Configuration({
|
||||||
|
apiKey: 'your-api-key',
|
||||||
|
// basePath defaults to https://tensors-api.saiden.dev
|
||||||
|
})
|
||||||
|
|
||||||
|
// Unified search
|
||||||
|
const search = new SearchApi(config)
|
||||||
|
const results = await search.searchModelsApiSearchGet({ query: 'flux' })
|
||||||
|
|
||||||
|
// CivitAI specific
|
||||||
|
const civitai = new CivitAIApi(config)
|
||||||
|
const models = await civitai.searchModelsApiCivitaiSearchGet({ types: 'LORA' })
|
||||||
|
```
|
||||||
|
|
||||||
|
Repository: [github.com/saiden-dev/tensors-typescript](https://github.com/saiden-dev/tensors-typescript)
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user