from openai import OpenAI client = OpenAI() # シークレットキーを直接入れる場合 # client = OpenAI(api_key="sk-xxxx") response = client.chat.completions.create( model="gpt-4-vision-preview", messages=[ { "role": "user", "content": [ {"type": "text", "text": "この画像には何が写っていますか?"}, { "type": "image_url", "image_url": "https://example.com/image.jpg", }, ], } ], max_tokens=300, ) print(response.choices[0])