Skip to content
Back to skills

face-compare

ASecurity

Compare two face photos and get a similarity score, using the SightRadar face recognition API. Use when the user asks whether two photos show the same person, wants 1:1 face matching or face verification, needs to check a selfie against an ID or profile photo, wants to find duplicate people across two images, or is replacing AWS Rekognition CompareFaces.

  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentspythonbashawsapisecurity

Works with

  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned December 5, 2026

npx -y skills add sightradar-hq/sightradar-skills --skill face-compare --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of face-compare?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for face-compare
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sightradar-hq-face-compare/badge)](https://www.skillsdirectory.com/skills/sightradar-hq-face-compare)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: face-compare
description: Compare two face photos and get a similarity score, using the SightRadar face recognition API. Use when the user asks whether two photos show the same person, wants 1:1 face matching or face verification, needs to check a selfie against an ID or profile photo, wants to find duplicate people across two images, or is replacing AWS Rekognition CompareFaces.
license: MIT
compatibility: Needs network access to api.sightradar.com, a SightRadar API key in SIGHTRADAR_API_KEY, and curl.
metadata:
  author: SightRadar team
  version: "1.0.0"
  homepage: https://sightradar.com
---

# Face compare: are these two photos the same person?

`POST https://api.sightradar.com/v1/compare` takes the clearest face in each of two images and returns a cosine similarity from 0 to 1 and a `match` boolean. Nothing is stored.

## Before you start

- Key: `export SIGHTRADAR_API_KEY="frs_..."` (create one at https://sightradar.com/dashboard/keys). Never print or commit it. If it is missing, ask the user to set it; do not ask them to paste it in chat.
- Cost: 93 credits per image processed, so one comparison of two images is 186 credits (about $0.0019). Say the total before comparing many pairs.
- Compare photos only of people who agreed to it.

## Compare

```bash
B="https://api.sightradar.com"; AUTH="Authorization: Bearer $SIGHTRADAR_API_KEY"

# Two local files
curl -s -X POST "$B/v1/compare" -H "$AUTH" -F "source=@./a.jpg" -F "target=@./b.jpg"

# Two public URLs
curl -s -X POST "$B/v1/compare" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"sourceUrl":"https://example.com/a.jpg","targetUrl":"https://example.com/b.jpg"}'
```

```json
{ "face_found": true, "similarity": 0.83, "match": true, "threshold": 0.42 }
```

- `similarity`: cosine similarity, 0 to 1. Higher means more alike. `null` when a face is missing.
- `match`: `similarity` is at or above `threshold`, the server's default cut-off, which is returned in the response.
- `face_found: false`: one of the images has no usable face. Run detect on each image (see the `face-detect` skill) to find which one, then ask for a clearer photo.

URLs must be fetchable from the public internet without login or cookies. If a call with URLs fails with a 4xx or 5xx, open each URL with `curl -I` first: a URL the API cannot download is the usual cause. Images can be up to 30 MB.

## In code

```python
# pip install sightradar
from sightradar import SightRadar
sr = SightRadar()                                    # reads SIGHTRADAR_API_KEY
r = sr.compare(source_url="https://example.com/a.jpg", target_url="https://example.com/b.jpg")
print(r.match, r.similarity)
```

```ts
// npm install sightradar
import { SightRadar } from "sightradar";
const sr = new SightRadar();
const r = await sr.compare({ sourceUrl: "https://example.com/a.jpg", targetUrl: "https://example.com/b.jpg" });
console.log(r.match, r.similarity);
```

## Reading the score

Report the number together with the verdict, for example "similarity 0.83, above the 0.42 default, so likely the same person". Then apply the user's own rule:

- The default threshold suits general matching. It is not a security setting. For anything where a wrong match is costly, the user should set a stricter cut-off tested on their own photos.
- Use two bands when a person can review: accept above the high cut-off, review in between, reject below the low one.
- A match shows that two faces look alike. It does not prove identity and it does not detect a photo of a photo. Identity verification also needs a document check and a liveness check.
- Twins, heavy filters, masks, very small faces and big age gaps all lower reliability. Say so when the score is borderline.

Threshold guide: https://sightradar.com/docs/guides/thresholds

## One person against many photos

Compare is 1:1. To check one face against hundreds of photos, index the photos into a collection once and search it (see the `face-search` skill): one search costs 93 credits no matter how large the collection is.

## Errors

400 bad body or an image that cannot be decoded. 401 bad key. 402 out of credits. 413 image over 30 MB. 429, 502, 503: wait and retry. Failed requests are not charged. Full docs: https://sightradar.com/llms.txt

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.