# Gpt-4-vision-preview not working - provided examples failing

**URL:** <https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236>\
**Category:** API\
**Tags:** gpt-4-vision\
**Created:** [April 1, 2024, 5:12pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236 "2024-04-01T17:12:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmntdy](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cmntdy](https://community.openai.com/u/cmntdy)\
**Post date:** [April 1, 2024, 5:12pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236/1 "2024-04-01T17:12:00Z")

</div>

The provided examples for gpt-4-vision-preview are failing. It’s acting like there are no images attached at all(even saying there are no images to look at).

Directly from the openai docs:

```auto
from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
  model="gpt-4-vision-preview",
  messages=[
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "What’s in this image?"},
        {
          "type": "image_url",
          "image_url": {
            "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
            "detail": "high"
          },
        },
      ],
    }
  ],
  max_tokens=300,
)

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

```

Anyone else seeing this?

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [April 1, 2024, 6:08pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236/2 "2024-04-01T18:08:33Z")

</div>

Works fine at low or high. That URL, or another.

```python
from openai import OpenAI
client = OpenAI()

response = client.chat.completions.with_raw_response.create(
  model="gpt-4-vision-preview",
  messages=[
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "What’s in this image?"},
        {
          "type": "image_url",
          "image_url": {
            "url": "https://i.imgur.com/oeYzasc.jpeg",
            "detail": "high"
          },
        },
      ],
    }
  ],
  max_tokens=300,
)

print(response.http_response.text)
print(f"time: {response.elapsed.total_seconds():.2f}s")

```

You can look at the `prompt_tokens` count of the failed call to see if an image was included.

Having OpenAI retrieve the images can be less reliable than your own image retrieval. Providers may block known OpenAI IP addresses, or OpenAI may respect a robots.txt file. You can download yourself and then call, resized to control costs, by the base64 format, and then see any URL errors before calling the API instead of merely having a confused AI.

Also check Python is 3.8-3.11, and OpenAI library is recent (1.12+).

---

<div class="post-metadata">

**Author:** ![nikpmr](https://avatars.discourse-cdn.com/v4/letter/n/c2a13f/32.png) [@nikpmr](https://community.openai.com/u/nikpmr)\
**Post date:** [April 1, 2024, 6:12pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236/3 "2024-04-01T18:12:22Z")

</div>

I’m getting the “server\_error” message when using the same example as OP. “detail” does not work for me either.

---

<div class="post-metadata">

**Author:** ![tummasterly](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/tummasterly/32/9171_2.png) [@tummasterly](https://community.openai.com/u/tummasterly)\
**Post date:** [April 24, 2024, 1:47pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236/4 "2024-04-24T13:47:41Z")

</div>

I am using the official example, using get-4-vision to process an image, also has a error ‘openai.NotFoundError: Error code: 404 - {‘error’: {‘code’: ‘404’, ‘message’: ‘Resource not found’}}’  
even if it works for text input.  
Any insights?

---

<div class="post-metadata">

**Author:** ![jr.2509](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jr.2509](https://community.openai.com/u/jr.2509)\
**Post date:** [April 24, 2024, 1:53pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236/5 "2024-04-24T13:53:07Z")

</div>

Looks like you might be using the wrong model.

You can either use gpt-4-vision-preview or gpt-4-turbo - the latter now also has vision capabilities.

See also [here](https://platform.openai.com/docs/guides/vision) and [here](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4) for reference.

---

<div class="post-metadata">

**Author:** ![tummasterly](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/tummasterly/32/9171_2.png) [@tummasterly](https://community.openai.com/u/tummasterly)\
**Post date:** [April 24, 2024, 1:59pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236/6 "2024-04-24T13:59:02Z")

</div>

thanks for fast reply, i am using get-4-vision-preview in Azure OpenAI service. it should be the right model.

with "  
client = AzureOpenAI(  
api\_key = api\_key,  
api\_version = api\_version,  
azure\_endpoint = api\_base  
)

response = client.chat.completions.create(  
model=deployment\_name, # model = “deployment\_name”.  
messages=[  
{“role”: “system”, “content”: “Assistant is a large language model trained by OpenAI.”},  
{“role”: “user”, “content”: “Who were the founders of Microsoft?”}  
]  
)

print(response)  
print(response.model\_dump\_json(indent=2))  
print(response.choices[0].message.content)  
"  
works well;

but with "  
client = AzureOpenAI(  
api\_key=api\_key,  
api\_version=api\_version,  
base\_url=f"{api\_base}openai/deployments/{deployment\_name}/extensions",  
)

response = client.chat.completions.create(  
model=deployment\_name,  
messages=[  
{ “role”: “system”, “content”: “You are a helpful assistant.” },  
{ “role”: “user”, “content”: [  
{  
“type”: “text”,  
“text”: “Describe this picture:”  
},  
{  
“type”: “image\_url”,  
“image\_url”: {  
“url”: data\_url  
}  
}  
] }  
],  
max\_tokens=2000  
)  
print(response.choices[0])  
print(response.choices[0].message.content)  
"  
has the error 404.

---

<div class="post-metadata">

**Author:** ![jr.2509](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jr.2509](https://community.openai.com/u/jr.2509)\
**Post date:** [April 24, 2024, 2:09pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236/7 "2024-04-24T14:09:38Z")

</div>

The reason why I mentioned “wrong model” is that you refer to “get” vs “gpt”.  
This points towards a possible spelling error.

---

<div class="post-metadata">

**Author:** ![tummasterly](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/tummasterly/32/9171_2.png) [@tummasterly](https://community.openai.com/u/tummasterly)\
**Post date:** [April 24, 2024, 2:14pm UTC](https://community.openai.com/t/gpt-4-vision-preview-not-working-provided-examples-failing/704236/8 "2024-04-24T14:14:50Z")

</div>

i see, thanks for the reminding. hahah  
now it works, i changed the api-version, the it worked. thanks a lot!
