Gemini Media Recognition (Native Format)
Beyond text chat, the Gemini native API supports uploading images, PDFs, audio, and video to the same generateContent endpoint for recognition and understanding, using the same Base URL and authentication as Gemini Text Chat.
inlineData Base64 uploads only
YouQi AI only supports inlining media as Base64 via inlineData. It does not support fileData.fileUri or the Gemini File API (upload-then-reference). Encode your file as Base64 and embed it directly in the request body.
Endpoint
POST /v1beta/models/{model}:generateContentBase URL and auth are the same as Gemini Text Chat: https://ai.youqi.tech/v1beta, authenticated via the ?key= query parameter or the x-goog-api-key header.
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
contents | array | Yes | Conversation contents, each with role and parts |
parts[].text | string | No | Text prompt |
parts[].inlineData | object | No | Inline media data with mimeType and data (Base64 string) |
Request examples
Image recognition
curl "https://ai.youqi.tech/v1beta/models/gemini-2.5-pro:generateContent?key=sk-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{ "text": "What is in this image?" },
{
"inlineData": {
"mimeType": "image/jpeg",
"data": "BASE64_ENCODED_IMAGE_DATA"
}
}
]
}
]
}'PDF / audio / video recognition
Replace mimeType with the matching type (e.g. application/pdf, audio/mp3, video/mp4) and data with that file's Base64 encoding; the rest of the structure is the same:
{
"contents": [
{
"role": "user",
"parts": [
{ "text": "Summarize the key points of this PDF." },
{
"inlineData": {
"mimeType": "application/pdf",
"data": "BASE64_ENCODED_PDF_DATA"
}
}
]
}
]
}Response example
{
"candidates": [
{
"content": {
"role": "model",
"parts": [{ "text": "The image shows a golden retriever running on grass." }]
},
"finishReason": "STOP"
}
],
"usageMetadata": {
"promptTokenCount": 258,
"candidatesTokenCount": 18,
"totalTokenCount": 276
}
}TIP
Base64 encoding significantly increases the request body size — watch client and gateway request size limits for large files. For text-only chat, use Gemini Text Chat instead.