import requests, json, sys, base64

API_KEY = "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"
MODEL = "google/gemini-2.5-flash-lite"

prompt = sys.argv[1]
paths = sys.argv[2:]

content = [{"type": "text", "text": prompt}]
for p in paths:
    with open(p, "rb") as f:
        b64 = base64.b64encode(f.read()).decode()
    content.append({"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}})

resp = requests.post(
    "https://openrouter.ai/api/v1/chat/completions",
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={"model": MODEL, "messages": [{"role": "user", "content": content}], "max_tokens": 2000}
)
print(resp.json()["choices"][0]["message"]["content"])
