Skip to main content
POST
/
nsfw
/
image
cURL
curl --request POST \
  --url https://nano-gpt.com/api/nsfw/image \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "image_urls": "https://example.com/image.jpg",
  "imageUrls": "https://example.com/image.jpg",
  "imageUrl": "https://example.com/image.jpg",
  "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...",
  "imageDataUrls": [
    "<string>"
  ],
  "model": "nsfw-classifier"
}
'
{
  "model": "nsfw-classifier",
  "requestId": "<string>",
  "inputCount": 2,
  "cost": 0.003,
  "currency": "USD",
  "truncated": false,
  "has_nsfw_concepts": [
    false,
    true
  ],
  "is_nsfw": true
}

Overview

The NSFW Image Classification endpoint performs binary classification on image URLs (or base64 data URLs) and returns whether each image contains NSFW concepts. Send up to 10 images per request.

Authentication

Include your API key in the request header:
x-api-key: YOUR_API_KEY
Alternatively, you can use Bearer token authentication:
Authorization: Bearer YOUR_API_KEY

Request

Headers

Content-Type: application/json
x-api-key: YOUR_API_KEY

Body parameters

You may provide images in any of the following fields. The endpoint accepts up to 10 images per request.
ParameterTypeRequiredDescription
image_urlsstring | string[]NoPrimary input field. One URL or an array of URLs.
imageUrlsstring | string[]NoAlias for image_urls.
imageUrlstringNoAlias for a single image URL.
imageDataUrlstringNoBase64 data URL for a single image.
imageDataUrlsstring[]NoBase64 data URLs for multiple images.
modelstringNoOnly supported value is nsfw-classifier (default).
At least one image field is required. If more than 10 images are provided, only the first 10 are processed and billed.

Example request

{
  "image_urls": [
    "https://example.com/image-1.jpg",
    "https://example.com/image-2.jpg"
  ]
}

Response

Success (200)

{
  "model": "nsfw-classifier",
  "requestId": "<request-id>",
  "inputCount": 2,
  "cost": 0.003,
  "currency": "USD",
  "truncated": false,
  "has_nsfw_concepts": [false, true],
  "is_nsfw": true
}

Response fields

  • model: The classifier model used.
  • requestId: Request ID (if available; helpful for support).
  • inputCount: Number of images processed (max 10).
  • cost: Final charged amount (after discounts and currency conversion).
  • currency: USD or XNO depending on payment source.
  • truncated: true if more than 10 images were provided.
  • has_nsfw_concepts: List of booleans (one per image, in input order).
  • is_nsfw: true if any image was flagged.

Errors

400 – Invalid or policy violation

  • Missing or invalid image URLs
  • JSON parsing error
  • Policy violation (returns a safety error message)
{ "error": "No valid image URLs provided" }

401 – Unauthorized

{ "error": "Unauthorized" }

429 – Rate limit or API key usage limits

{ "error": "Rate limit exceeded" }

500 – Server or provider failure

{ "error": "NSFW classification failed" }

Billing Notes

  • Charged $0.0015 per image actually sent to the classifier.
  • If more than 10 images are provided, only the first 10 are billed/processed.
  • Discounts and referral policies apply as with other endpoints.

Code Examples

curl -X POST https://nano-gpt.com/api/nsfw/image \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "image_urls": [
      "https://example.com/image-1.jpg",
      "https://example.com/image-2.jpg"
    ]
  }'

Authorizations

x-api-key
string
header
required

Body

application/json

NSFW image classification request

NSFW image classification request payload

image_urls

Primary input field. One URL or an array of URLs (only the first 10 are processed).

Example:

"https://example.com/image.jpg"

imageUrls

Alias for image_urls. One URL or an array of URLs (only the first 10 are processed).

Example:

"https://example.com/image.jpg"

imageUrl
string<uri>

Alias for a single image URL

Example:

"https://example.com/image.jpg"

imageDataUrl
string

Base64 data URL for a single image (format: data:image/[type];base64,[data])

Example:

"data:image/jpeg;base64,/9j/4AAQ..."

imageDataUrls
string[]

Base64 data URLs for multiple images (only the first 10 are processed)

Minimum array length: 1
model
string
default:nsfw-classifier

Only supported value is nsfw-classifier

Response

NSFW classification response

model
string

The classifier model used

Example:

"nsfw-classifier"

requestId
string

Request ID (if available; helpful for support)

inputCount
integer

Number of images processed (max 10)

Example:

2

cost
number

Final charged amount (after discounts and currency conversion)

Example:

0.003

currency
string

Currency of the charge

Example:

"USD"

truncated
boolean

True if more than 10 images were provided

Example:

false

has_nsfw_concepts
boolean[]

Per-image NSFW flags in input order

Example:
[false, true]
is_nsfw
boolean

True if any image was flagged

Example:

true