LinkShieldAI Rust SDK
New integrations should use client.scan(url, mode).await, which calls Bearer-authenticated POST /v1/scan. Existing methods remain for compatibility.
let client = new?;
let result = client.scan.await?;
println!;
UNKNOWN means the API found no decisive signal. Do not treat it as SAFE.
Rust SDK for the LinkShieldAI API at https://api.linkshieldai.com.
The SDK supports basic URL safety checks, detailed checks with screenshot URL and detected tag, screenshot download, NSFW site checks, Chimera AI classification, retry/backoff for transient API failures, and a small command-line tool.
Install
[]
= "0.2"
Authentication
Every SDK request sends the key as an Authorization: Bearer header. Legacy endpoints receive only the URL as a query parameter.
use LinkShieldAI;
async
Or set LINKSHIELDAI_API_KEY and pass an empty string:
let client = new?;
Methods
let basic = client.basic_check.await?;
let detailed = client.detailed_check.await?;
let nsfw = client.nsfw_check.await?;
let chimera = client.chimera.await?;
let is_malicious = client.is_malicious.await?;
let is_nsfw = client.is_nsfw.await?;
let bytes = client.get_screenshot.await?;
The API field "screenshot url" is normalized to screenshot_url.
Options
use Duration;
use LinkShieldAI;
let client = builder
.api_key
.base_url
.timeout
.max_retries
.backoff_factor
.build?;
By default the SDK uses:
timeout: 10 secondsmax_retries: 2backoff_factor: 500 ms
Retries are applied to temporary connection failures and HTTP 429, 502, 503, and 504.
CLI
You can omit --api-key if LINKSHIELDAI_API_KEY is set.
Errors
match error
Raw API payloads are preserved on result structs through raw.
Keep API keys server-side.