Image input
AI Foundation Services provides vision models that can analyze images alongside text. Use the same Chat Completions API with image content.
What you’ll learn:
- How to analyze images from URLs
- How to send local images via base64 encoding
- How to find out which models accept images
Analyze an image from URL
Section titled “Analyze an image from URL”curl -X POST "$OPENAI_BASE_URL /chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "Qwen3.6-35B-A3B-FP8", "messages": [ { "role": "user", "content": [ {"type": "text", "text": "What is in this image?"}, {"type": "image_url", "image_url": {"url": "https://images.unsplash.com/photo-1546069901-ba9599a7e63c?w=400"}} ] } ], "max_tokens": 1024 }' from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create( model="Qwen3.6-35B-A3B-FP8" , messages=[ { "role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, { "type": "image_url" , "image_url" : { "url": "https://images.unsplash.com/photo-1546069901-ba9599a7e63c?w=400" }, }, ], } ], max_tokens =1024 ,)
print(response.choices[ 0].message.content) import OpenAI from "openai";
const client = new OpenAI();
const response = await client.chat.completions. create ({ model: "Qwen3.6-35B-A3B-FP8" , messages: [ { role: "user", content: [ { type: "text", text: "What's in this image?" }, { type: "image_url" , image_url: { url: "https://images.unsplash.com/photo-1546069901-ba9599a7e63c?w=400" , }, }, ], }, ], max_tokens: 1024,});
console.log (response.choices[ 0].message.content); Analyze a local image (Base64)
Section titled “Analyze a local image (Base64)”You can also pass a local image as a base64-encoded string:
import base64
from openai import OpenAI
client = OpenAI()
def encode_image (image_path): with open(image_path, "rb") as f: return base64.b64encode(f.read()).decode( "utf-8" )
base64_image = encode_image( "/path/to/your/image.jpg" )
response = client.chat.completions.create( model="Qwen3.6-35B-A3B-FP8" , messages=[ { "role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, { "type": "image_url" , "image_url" : {"url": f"data:image/jpeg;base64, { base64_image }" }, }, ], } ], max_tokens =1000 ,)
print(response.choices[ 0].message.content) Example models with image input
Section titled “Example models with image input”| Model (example) | Provider | Capabilities |
|---|---|---|
Qwen3. | T Cloud, Germany (EU) | Text and image input |
gemma- | T Cloud, Germany (EU) | Text and image input |
Limitations and troubleshooting
Section titled “Limitations and troubleshooting”For scanned pages and handwriting, use the two OCR models.
Next steps
Section titled “Next steps”- Function calling — Connect models to external tools
- Streaming — Stream responses for better UX