Skip to main content

Image Recognition

Use multimodal models to recognize image content and return text descriptions/answers.

This interface is compatible with Chat Completions, using the same endpoint: POST /v1/chat/completions.

Try It

POST/v1/chat/completionshttps://api-platform.ope.ai

Authentication

Uses Bearer Token authentication.

  • Header: Authorization: Bearer <token>
  • Example: Authorization: Bearer sk-xxxxxx

Request body (application/json)

FieldTypeRequiredDescriptionDefault / Range
modelstringYesModel ID (multimodal/vision model)Example: Image-Recognition
messagesarray<object>YesConversation message list (supports mixed image-text content)-
max_tokensintegerNoMaximum output tokens-
temperaturenumberNoSampling temperatureDefault 1; Range 0~2
top_pnumberNoNucleus sampling parameterDefault 1; Range 0~1
top_kintegerNoTop-K sampling parameter-
frequency_penaltynumberNoFrequency penaltyDefault 0; Range -2~2

messages.content (mixed image-text)

messages[].content supports array format, with two common item types:

  • Image:
    • {"type":"image_url","image_url":{"url":"data:image/jpeg;base64,<BASE64_IMAGE>"}}
  • Text:
    • {"type":"text","text":"What is this?"}

image_url.url can be either a network image URL or a Data URL (e.g., data:image/jpeg;base64,...).

Request examples

The domain below is an example: https://api-platform.ope.ai.

curl -X POST "https://api-platform.ope.ai/v1/chat/completions" \
-H "Authorization: Bearer $OPEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Image-Recognition",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABA...(omitted)"
}
},
{ "type": "text", "text": "What is this?" }
]
}
]
}'

Response examples

{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": { "name": "string", "arguments": "string" }
}
],
"tool_call_id": "string",
"reasoning_content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
},
"system_fingerprint": "string"
}