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"
}
'import requests
url = "https://nano-gpt.com/api/nsfw/image"
payload = {
"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"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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'
})
};
fetch('https://nano-gpt.com/api/nsfw/image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nano-gpt.com/api/nsfw/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://nano-gpt.com/api/nsfw/image"
payload := strings.NewReader("{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"<string>\"\n ],\n \"model\": \"nsfw-classifier\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://nano-gpt.com/api/nsfw/image")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"<string>\"\n ],\n \"model\": \"nsfw-classifier\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://nano-gpt.com/api/nsfw/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"<string>\"\n ],\n \"model\": \"nsfw-classifier\"\n}"
response = http.request(request)
puts response.read_body{
"model": "nsfw-classifier",
"requestId": "<string>",
"inputCount": 2,
"cost": 0.003,
"currency": "USD",
"truncated": false,
"has_nsfw_concepts": [
false,
true
],
"is_nsfw": true
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}NSFW Image Classification
Binary NSFW classification for up to 10 image URLs or data URLs per request
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"
}
'import requests
url = "https://nano-gpt.com/api/nsfw/image"
payload = {
"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"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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'
})
};
fetch('https://nano-gpt.com/api/nsfw/image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nano-gpt.com/api/nsfw/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://nano-gpt.com/api/nsfw/image"
payload := strings.NewReader("{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"<string>\"\n ],\n \"model\": \"nsfw-classifier\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://nano-gpt.com/api/nsfw/image")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"<string>\"\n ],\n \"model\": \"nsfw-classifier\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://nano-gpt.com/api/nsfw/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"<string>\"\n ],\n \"model\": \"nsfw-classifier\"\n}"
response = http.request(request)
puts response.read_body{
"model": "nsfw-classifier",
"requestId": "<string>",
"inputCount": 2,
"cost": 0.003,
"currency": "USD",
"truncated": false,
"has_nsfw_concepts": [
false,
true
],
"is_nsfw": true
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}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
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.| Parameter | Type | Required | Description |
|---|---|---|---|
image_urls | string | string[] | No | Primary input field. One URL or an array of URLs. |
imageUrls | string | string[] | No | Alias for image_urls. |
imageUrl | string | No | Alias for a single image URL. |
imageDataUrl | string | No | Base64 data URL for a single image. |
imageDataUrls | string[] | No | Base64 data URLs for multiple images. |
model | string | No | Only supported value is nsfw-classifier (default). |
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:USDorXNOdepending on payment source.truncated:trueif more than 10 images were provided.has_nsfw_concepts: List of booleans (one per image, in input order).is_nsfw:trueif 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"
]
}'
import requests
api_key = "YOUR_API_KEY"
payload = {
"image_urls": [
"https://example.com/image-1.jpg",
"https://example.com/image-2.jpg"
]
}
response = requests.post(
"https://nano-gpt.com/api/nsfw/image",
headers={
"Content-Type": "application/json",
"x-api-key": api_key
},
json=payload
)
print(response.json())
const apiKey = 'YOUR_API_KEY';
const response = await fetch('https://nano-gpt.com/api/nsfw/image', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': apiKey
},
body: JSON.stringify({
image_urls: [
'https://example.com/image-1.jpg',
'https://example.com/image-2.jpg'
]
})
});
const data = await response.json();
console.log(data);
Authorizations
Body
NSFW image classification request
NSFW image classification request payload
Primary input field. One URL or an array of URLs (only the first 10 are processed).
"https://example.com/image.jpg"
Alias for image_urls. One URL or an array of URLs (only the first 10 are processed).
"https://example.com/image.jpg"
Alias for a single image URL
"https://example.com/image.jpg"
Base64 data URL for a single image (format: data:image/[type];base64,[data])
"data:image/jpeg;base64,/9j/4AAQ..."
Base64 data URLs for multiple images (only the first 10 are processed)
1Only supported value is nsfw-classifier
Response
NSFW classification response
The classifier model used
"nsfw-classifier"
Request ID (if available; helpful for support)
Number of images processed (max 10)
2
Final charged amount (after discounts and currency conversion)
0.003
Currency of the charge
"USD"
True if more than 10 images were provided
false
Per-image NSFW flags in input order
[false, true]
True if any image was flagged
true