Spaces:
Sleeping
Sleeping
File size: 4,057 Bytes
c0b1b71 f335e22 c0b1b71 f335e22 c0b1b71 f335e22 c0b1b71 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | # API Reference
> Two entry points are available:
>
> - **`src.standard.pipeline`** — v1.5.1 production Standard Pipeline (recommended)
> - **`src.methodologies.humanizer`** — v1.0 multi-method dispatcher (reference)
---
## Standard Pipeline (v1.5.1, recommended)
### CLI
```bash
python -m src.standard.pipeline [OPTIONS]
```
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `--input` | string | required | Input text or path to text file |
| `--target` | string | `en` | Target language code |
| `--config` | string | `config/config.toml` | Path to config file |
| `--output` | string | stdout | Output file path |
| `--verbose` | flag | off | Show step-by-step progress |
**Examples:**
```bash
# Basic usage
python -m src.standard.pipeline --input "Your AI text here"
# With verbose step tracing
python -m src.standard.pipeline --input input.txt --output result.txt --verbose
# Different target language
python -m src.standard.pipeline --input input.txt --target zh
```
### Python API
```python
from src.standard import run_standard_pipeline
import toml
config = toml.load("config/config.toml")
result = run_standard_pipeline(
text="Your AI text here",
config=config,
target_lang="en",
)
print(result["result"]) # final humanized text
print(result["processing_time_ms"]) # total elapsed time
for step in result["steps"]:
print(step["step"], step["engine"], step["direction"], step["length"])
# step["engine"] reflects the configured [llm].provider
```
### LLM provider configuration
Steps 1–2 use an OpenAI-compatible chat API configured in `config.toml` under `[llm]`:
```toml
[llm]
provider = "deepseek" # or "openrouter", "openai", "nvidia"
base_url = "" # empty = provider default; override for custom endpoints
model = "" # empty = provider default model
temperature = 1.3
```
Resolve settings programmatically:
```python
from src.standard.llm_client import resolve_llm_config
llm = resolve_llm_config(config)
# llm["provider"], llm["base_url"], llm["model"], llm["api_key"], llm["display_name"]
```
See [configuration.md](configuration.md) for API keys, provider model slugs, and env overrides (`LLM_PROVIDER`, `LLM_BASE_URL`, `NVIDIA_API_KEY`, etc.).
---
## v1.0 Methodology Dispatcher (reference)
### CLI
```bash
python -m src.methodologies.humanizer [OPTIONS]
```
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `--input` | string | required | Input text or path to text file |
| `--method` | string | `translation_chain` | `translation_chain`, `llm_rewrite`, `detection_guided`, `mixed_engine` |
| `--output` | string | stdout | Output file path |
| `--language` | string | `en` | Target language code |
| `--tier` | string | `standard` | Processing tier |
| `--config` | string | `config/config.toml` | Path to config file |
| `--serve` | flag | off | Start FastAPI server on port 8000 |
**Examples:**
```bash
# Basic usage with a methodology
python -m src.methodologies.humanizer --input "Your AI text here" --method llm_rewrite
# Detection-guided with custom config
python -m src.methodologies.humanizer --input input.txt --method detection_guided --config my_config.toml
```
### Python API
```python
from src.methodologies.humanizer import Humanizer
h = Humanizer(config_path="config/config.toml")
result = h.process("Your AI text here", method="translation_chain")
print(result.text)
```
### REST API (Docker)
When running via Docker, the v1.0 dispatcher's FastAPI app is exposed at `http://localhost:8000`.
```bash
curl -X POST http://localhost:8000/humanize \
-H "Content-Type: application/json" \
-d '{"text": "Your AI text here", "method": "translation_chain"}'
```
Endpoints:
- `POST /humanize` — run a methodology
- `GET /methods` — list available methodologies
- `GET /health` — health check
---
> **Want a managed API with intelligent tier selection?** [Lynote.ai](https://lynote.ai) handles tier selection automatically. Paste & go.
|