Image Describer API Documentation
2025-02-22
Posted byImage Describer API Documentation
Introduction & Use Cases
Image Describer API allows you to integrate AI-powered image description capabilities into your applications. Our API uses advanced AI models to analyze images and generate detailed descriptions.
Common Use Cases
- Generate detailed descriptions for images
- Extract text and information from images
- Analyze image content and context
- Create character descriptions for creative writing
- Generate image captions for content management
API Keys
To use our API, you'll need to obtain API credentials (API Key and Secret). You can manage your API keys in the dashboard.
API Endpoint
POST https://imagedescriber.online/api/openapi/describe-image
Integration Guide
Request Headers
Header Name | Required | Description |
---|---|---|
content-type | Yes | Must be multipart/form-data |
appid | Yes | Your API key obtained from the dashboard |
timestamp | Yes | Current timestamp in milliseconds |
nonce | Yes | Random UUID string for request uniqueness, must be unique and between 6 and 32 characters. e.g., 4dc6gvrjg1 |
signature | Yes | HMAC-SHA256 signature for authentication (See code examples) |
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
imageBase64Data | string | Yes | Base64 encoded image data with MIME type prefix (e.g., data:image/jpeg;base64,/9j/4AAQSkZJRgABAQE... ) |
prompt | string | No | Custom prompt for image analysis |
lang | string | No | Response language (en/zh/de/es/fr/ja/ko) |
Response Format
Field | Type | Description |
---|---|---|
code | number | Response status code. 200 for success |
data | object | Response data object, present when code is 200 |
data.content | string | The generated description for the image |
msg | string | Response message, provides additional information |
succeed | boolean | Indicates whether the request was successful |
Example Response
{
"code": 200,
"data": {
"content": "Detailed description of the image in markdown format..."
},
"succeed": true,
"msg": "Success"
}
Error Codes
Code | Message | Description |
---|---|---|
200 | OK | Request successful |
500 | SERVER_ERROR | Internal server error |
10003 | INSUFFICIENT_CREDITS | Insufficient credits |
10004 | INVALID_PARAM | Invalid parameters |
10005 | HARMFUL_CONTENT | Harmful content detected |
30001 | INVALID_API_KEY | Invalid API key |
30002 | INVALID_SIGNATURE | Invalid request signature |
Code Examples
Next.js Example
import fs from 'fs';
// Get image base64 data: Server-side implementation
const buffer = await fs.readFileSync("/temp/test.jpg");
const base64Image = buffer.toString('base64');
const imageBase64Data = `data:image/jpeg;base64,${base64Image}`;
// Get image base64 data: Client-side implementation
const file:File = /* file from input or drop event */;
const arrayBuffer = await file.arrayBuffer();
const bytes = new Uint8Array(arrayBuffer);
const base64Image = btoa(String.fromCharCode.apply(null, bytes as any));
const imageBase64Data = `data:${file.type};base64,${base64Image}`;
// Request Body
const formData = new FormData();
formData.append('imageBase64Data', imageBase64Data);
formData.append('lang', 'en');
formData.append('prompt', 'Summarize the content of the picture in one sentence, then describe in detail what is in the picture, including objects, people, animals, and the atmosphere and mood of the picture');
// Signature
const appid = "app_1234567";
const secret = "sk_a8f3dbb3...";
const timestamp = Date.now().toString();
const nonce = crypto.randomBytes(4).toString('hex');
const signStr = buildSignString(appid, timestamp, nonce); // See subsequent code for function implementation
const sign = await sign(signStr, secret); // See subsequent code for function implementation
// Do Request
const response = await fetch('https://imagedescriber.online/api/openapi/describe-image', {
method: 'POST',
headers: {
'appid': appid,
'timestamp': timestamp,
'nonce': nonce,
'signature': sign
},
body: formData
});
const result = await response.json();
console.log(result);
function buildSignString(appId: string, timestamp: string, nonce: string): string {
return [appId, timestamp, nonce].join('-');
}
async function sign(message: string, secret: string): Promise<string> {
const encoder = new TextEncoder();
const keyData = encoder.encode(secret);
const messageData = encoder.encode(message);
const key = await crypto.subtle.importKey(
'raw',
keyData,
{ name: 'HMAC', hash: 'SHA-256' },
false,
['sign']
);
const signatureData = await crypto.subtle.sign(
'HMAC',
key,
messageData
);
return btoa(String.fromCharCode.apply(null, Array.from(new Uint8Array(signatureData))));
}
Pricing
API calls consume credits from your account. You can purchase credits on our pricing page.
Help & Support
If you have any questions or need assistance, please don't hesitate to contact our support team.
Email: [email protected]