Skip to main content
Lesson 9 of 12 · Grok Vision: Understanding Images

Use store:false for Images

Lesson 9 of 12 Updated July 30, 2026 Beginner
On this page
  1. Why You Shouldn’t Store Images
  2. The Problem with Storing Images
  3. How to Disable Storage
  4. Impact on Conversation Chaining
  5. Best Practice: Systematic Wrapper
  6. Key Takeaways

Why You Shouldn’t Store Images

xAI’s Responses API offers a feature for server-side storage of requests and responses. Enabled by default with store: true, this persistence retains your interactions for 30 days. However, when working with images, xAI documentation explicitly recommends disabling this storage.

The Problem with Storing Images

When you send images with store: true (the default behavior), the full request—including image data—is retained on xAI servers. This creates two major issues:

Request Failures

xAI documentation warns: requests containing images may fail if storage is enabled. This behavior occurs particularly when:

  • Images are large (close to the 20 MiB limit)
  • Multiple images are sent in the same request
  • Images are Base64 encoded (the encoded string is ~33% larger than the original file)

GDPR and Privacy Considerations

If your images contain personal data (ID photos, sensitive documents, faces), storing them for 30 days on a third-party server raises compliance questions with GDPR and European regulations.

How to Disable Storage

The solution is simple: add store: false to every request containing images.

Responses API (Python)

response = client.responses.create(
    model="grok-4.5",
    input=[
        {"type": "input_image", "image_url": url_image},
        {"type": "input_text", "text": "Describe this image."}
    ],
    store=False  # Disable storage
)

Responses API (cURL)

curl -X POST "https://api.x.ai/v1/responses" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-4.5",
    "store": false,
    "input": [
      {"type": "input_image", "image_url": "https://exemple.com/photo.jpg"},
      {"type": "input_text", "text": "Describe this image."}
    ]
  }'

Chat Completions API

The Chat Completions API is stateless by nature and stores nothing server-side. No additional configuration is needed. This is one of the advantages of this endpoint for processing sensitive images.

Impact on Conversation Chaining

With store: false, you lose the ability to use previous_response_id to chain requests. Each request becomes independent.

If you need to maintain conversational context around images, two approaches are possible:

Approach 1: Manually Pass Context

# First request
response1 = client.responses.create(
    model="grok-4.5",
    input=[
        {"type": "input_image", "image_url": url_image},
        {"type": "input_text", "text": "Describe this image."}
    ],
    store=False
)

# Second request: include previous response as context
response2 = client.responses.create(
    model="grok-4.5",
    input=[
        {"type": "input_text", "text": f"Previous context: {response1.output_text}"},
        {"type": "input_image", "image_url": url_image},
        {"type": "input_text", "text": "Now, identify the dominant colors."}
    ],
    store=False
)

Approach 2: Use Chat Completions

If chaining is essential, use the Chat Completions API, which handles context via the messages array without storing anything:

messages = [
    {
        "role": "user",
        "content": [
            {"type": "image_url", "image_url": {"url": url_image}},
            {"type": "text", "text": "Describe this image."}
        ]
    }
]

response1 = client.chat.completions.create(
    model="grok-4.5",
    messages=messages
)

# Add the response and the next question
messages.append({"role": "assistant", "content": response1.choices[0].message.content})
messages.append({"role": "user", "content": "Identify the dominant colors."})

response2 = client.chat.completions.create(
    model="grok-4.5",
    messages=messages
)

Best Practice: Systematic Wrapper

To never forget store: false when working with images, create a wrapper:

def vision_request(images, prompt, detail="auto"):
    """Vision request with automatic store:false."""
    input_data = []

    for img in images:
        input_data.append({
            "type": "input_image",
            "image_url": img,
            "detail": detail
        })

    input_data.append({
        "type": "input_text",
        "text": prompt
    })

    return client.responses.create(
        model="grok-4.5",
        input=input_data,
        store=False  # Always disabled for images
    )

Key Takeaways

  • Always use store: false when sending images via the Responses API
  • Enabled storage can cause request failures with images
  • store: false also protects visual data privacy
  • Chaining via previous_response_id is not available with store: false
  • The Chat Completions API is naturally stateless and does not require this option