> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kiosapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Obrolan - Analisis Gambar (Visi)

> Analisis gambar menggunakan model obrolan berkemampuan penglihatan

# Obrolan - Analisis Gambar

Kirim gambar untuk dianalisis menggunakan model berkemampuan penglihatan. Model harus mendukung analisis gambar (misalnya `gpt-5.5`, `gpt-5.5-vision-preview`).

## Permintaan

### Header

| Header | Wajib | Deskripsi |
| - | - | - |
| `Content-Type` | Ya | `application/json` |
| `Authorization` | Ya | `Bearer sk-xxx` |

### Badan Permintaan

| Parameter | Tipe | Wajib | Deskripsi |
| - | - | - | - |
| `model` | string | Ya | Model berkemampuan penglihatan (misalnya `gpt-5.5`) |
| `messages` | array | Ya | Array objek pesan dengan konten multimodal |
| `messages[].role` | string | Ya | Peran: `user` |
| `messages[].content` | array | Ya | Array objek teks dan gambar |
| `max_tokens` | number | Tidak | Token maksimum untuk dihasilkan |
| `temperature` | number | Tidak | Suhu pengambilan sampel (0-2) |
| `stream` | boolean | Tidak | Aktifkan streaming |

### Jenis Konten

Array `content` mendukung:

| Jenis | Bidang | Deskripsi |
| - | - | - |
| `text` | `text` | Perintah teks |
| `image_url` | `image_url.url` | URL Gambar (mendukung base64 dan URL web) |

### Contoh Permintaan

```bash theme={null}
curl https://kiosapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxx" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What is in this image?"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://example.com/image.png"
            }
          }
        ]
      }
    ],
    "max_tokens": 300
  }'
```

### Contoh Python

```python theme={null}
import openai

openai.api_key = "sk-xxx"
openai.base_url = "https://kiosapi.com/v1/"

response = openai.chat.completions.create(
    model="gpt-5.5",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What is in this image?"},
                {
                    "type": "image_url",
                    "image_url": {"url": "https://example.com/image.png"}
                }
            ]
        }
    ],
    max_tokens=300,
)

print(response.choices[0].message.content)
```

> [!TIP]
>
> URL gambar mendukung URI data base64 dan URL web. Format Base64: `data:image/png;base64,iVBOR...`

## Respons

```json theme={null}
{
  "id": "chatcmpl-A7ETdn5hnbTjpw9dtRifjMFZYcdFW",
  "object": "chat.completion",
  "created": 1726287309,
  "model": "gpt-5.5-2024-05-13",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "This image shows a cartoon-style portrait of an elderly man...",
        "refusal": null
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 265,
    "completion_tokens": 46,
    "total_tokens": 311
  },
  "system_fingerprint": "fp_992d1ea92d"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.