> ## Documentation Index
> Fetch the complete documentation index at: https://docs.perplexity.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Media & Attachments

> Send and receive images, videos, and files with the Sonar API

## Overview

The Sonar API supports comprehensive media handling: send images and files for analysis, and receive images and videos in responses. This guide covers all media functionality in one place.

## Sending Images

Send images to the API for analysis using either base64 encoding or HTTPS URLs. Images are embedded in the `messages` array alongside text content.

<Warning>
  * Base64 images: Maximum 50 MB per image. Supported formats: PNG, JPEG, WEBP, GIF
  * HTTPS URLs: Must be publicly accessible and point directly to the image file
</Warning>

### Base64 Encoded Images

Use base64 encoding when you have the image file locally:

```python Python SDK theme={null}
from perplexity import Perplexity
import base64

client = Perplexity()

# Read and encode image as base64
with open("path/to/your/image.png", "rb") as image_file:
    base64_image = base64.b64encode(image_file.read()).decode("utf-8")
    image_data_uri = f"data:image/png;base64,{base64_image}"

# Analyze the image
completion = client.chat.completions.create(
    model="sonar-pro",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Can you describe this image?"},
                {"type": "image_url", "image_url": {"url": image_data_uri}}
            ]
        }
    ]
)
print(completion.choices[0].message.content)
```

### HTTPS URL Images

Reference images hosted online:

```python Python SDK theme={null}
from perplexity import Perplexity

client = Perplexity()

image_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"

completion = client.chat.completions.create(
    model="sonar-pro",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Can you describe the image at this URL?"},
                {"type": "image_url", "image_url": {"url": image_url}}
            ]
        }
    ]
)
print(completion.choices[0].message.content)
```

### Key Parameters

* **Image format**: Use `data:image/{format};base64,{content}` for base64 (e.g., `data:image/png;base64,...`)
* **Token pricing**: Images are tokenized as `(width × height) / 750` tokens, priced at input token rates
* **Supported formats**: PNG (`image/png`), JPEG (`image/jpeg`), WEBP (`image/webp`), GIF (`image/gif`)

## Sending Files

Upload documents (PDF, DOC, DOCX, TXT, RTF) for analysis using URLs or base64 encoding. Files can be provided as publicly accessible URLs or base64 encoded bytes without any prefix.

<Warning>
  Maximum file size is 50MB per file. Files larger than this limit will not be processed.
</Warning>

### Using a Public URL

```python Python SDK theme={null}
from perplexity import Perplexity

client = Perplexity()

completion = client.chat.completions.create(
    model="sonar-pro",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Summarize this document"},
                {
                    "type": "file_url",
                    "file_url": {"url": "https://example.com/document.pdf"}
                }
            ]
        }
    ]
)
print(completion.choices[0].message.content)
```

### Using Base64 Encoding

```python Python SDK theme={null}
from perplexity import Perplexity
import base64

client = Perplexity()

# Read and encode file (no prefix needed)
with open("document.pdf", "rb") as file:
    encoded_file = base64.b64encode(file.read()).decode('utf-8')

completion = client.chat.completions.create(
    model="sonar-pro",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Summarize this document"},
                {
                    "type": "file_url",
                    "file_url": {"url": encoded_file}  # Just base64 string, no prefix
                }
            ]
        }
    ]
)
print(completion.choices[0].message.content)
```

### Key Parameters

* **Supported formats**: PDF, DOC, DOCX, TXT, RTF
* **Base64 encoding**: Provide only the base64 string without `data:` prefix
* **File size limit**: 50MB per file, maximum 30 files per request
* **URL requirements**: Must be publicly accessible and return the file directly

## Receiving Images

Control which images are returned in API responses using `return_images`, `image_domain_filter`, and `image_format_filter` parameters.

<Info>
  The `return_images` feature is currently only available in the Sonar API.
</Info>

### Basic Image Returns

Enable image returns by setting `return_images: true`:

```python Python SDK theme={null}
from perplexity import Perplexity

client = Perplexity()

completion = client.chat.completions.create(
    model="sonar",
    return_images=True,
    messages=[
        {"role": "user", "content": "Describe the James Webb Space Telescope's deep field observations and what they reveal about the early universe."}
    ]
)
print(completion.choices[0].message.content)
```

<Accordion title="Response">
  ```json theme={null}
  {
    "id": "a44ef176-1cc4-48ac-bc55-20f36992ac00",
    "choices": [
      {
        "delta": {
          "content": "",
          "role": "assistant",
          "reasoning_steps": null,
          "tool_call_id": null,
          "tool_calls": null
        },
        "index": 0,
        "message": {
          "content": "The James Webb Space Telescope’s **deep field** observations are ultra-long exposures of tiny patches of sky that reveal thousands of faint, distant galaxies, including objects seen from the Universe’s first billion years and beyond.[1][2][3] They show that the early Universe was already rich with galaxies of very different sizes, shapes, colors, and dust contents, giving astronomers a new way to study how galaxies assembled and evolved.[1][2][4]\n\nWebb’s deep fields matter because its **infrared** instruments can detect light that has been stretched by cosmic expansion out of visible wavelengths and into the infrared, where Webb is optimized to observe.[2][6] That lets astronomers see farther back in time than with Hubble and examine galaxies that were previously too faint, too red, or too obscured by dust to study well.[1][2][3]\n\nWhat the observations reveal about the early universe:\n\n- **Thousands of galaxies** appear in a very small patch of sky, showing that the distant universe was already highly populated with galaxies.[1][2][3]\n- Some galaxies are **extremely red**, which usually means either heavy dust obscuration or an older stellar population with mature stars formed early in cosmic history.[1][3]\n- Many of the farthest galaxies look **small, clumpy, and irregular** rather than like today’s well-ordered spirals and ellipticals, suggesting galaxies were still actively assembling.[4]\n- Webb’s sharp resolution reveals **star clusters, diffuse structure, and faint internal features** in galaxies billions of light-years away, improving measurements of their ages, masses, chemistry, and growth histories.[2][4]\n- Spectroscopic observations have already provided physical details for many targets, including light that traveled for **13.1 billion years**, helping constrain when stars and galaxies were forming.[2]\n- In some fields, Webb is seeing galaxies as they were **less than a billion years after the Big Bang**, extending the observational window into the cosmic dawn.[2][3]\n\nIn short, Webb’s deep fields are not just prettier images; they are a census of the early cosmos that is helping astronomers map when galaxies first appeared, how quickly they grew, how dust and star formation evolved, and how the first large cosmic structures took shape.[1][2][3][4]\n\n",
          "role": "assistant",
          "reasoning_steps": null,
          "tool_call_id": null,
          "tool_calls": null
        },
        "finish_reason": "stop"
      }
    ],
    "created": 1779896029,
    "model": "sonar-pro",
    "citations": [
      "https://esawebb.org/images/potm2507a/",
      "https://www.esa.int/Science_Exploration/Space_Science/Webb/Webb_delivers_deepest_image_of_Universe_yet",
      "https://www.space.com/astronomy/james-webb-space-telescope/james-webb-space-telescope-revisits-a-classic-hubble-image-of-over-2-500-galaxies",
      "https://science.nasa.gov/asset/webb/webbs-first-deep-field-nircam-image/",
      "https://www.youtube.com/watch?v=WdTkH1v2NqI",
      "https://science.nasa.gov/mission/webb/",
      "https://www.dailymotion.com/video/x9af4aq"
    ],
    "object": "chat.completion",
    "search_results": [
      {
        "title": "A fresh look at a classic deep field | ESA/Webb",
        "url": "https://esawebb.org/images/potm2507a/",
        "date": "2025-08-01",
        "last_updated": "2026-05-14",
        "snippet": "These deep observations have revealed more than 2500 sources in this tiny patch of sky. Among them are hundreds of extremely red galaxies — some ...",
        "source": "web"
      },
      {
        "title": "Webb delivers deepest image of Universe yet - ESA",
        "url": "https://www.esa.int/Science_Exploration/Space_Science/Webb/Webb_delivers_deepest_image_of_Universe_yet",
        "date": null,
        "last_updated": "2026-03-12",
        "snippet": "This deep field, taken by Webb's Near-Infrared Camera (NIRCam), is a composite made from images at different wavelengths, totaling 12.5 hours – achieving depths ...",
        "source": "web"
      },
      {
        "title": "James Webb Space Telescope revisits a classic Hubble image of ...",
        "url": "https://www.space.com/astronomy/james-webb-space-telescope/james-webb-space-telescope-revisits-a-classic-hubble-image-of-over-2-500-galaxies",
        "date": "2025-08-04",
        "last_updated": "2025-08-04",
        "snippet": "The deep fields were Hubble's most intense stares into the universe, revealing the faintest galaxies at the highest redshifts that Hubble could ...",
        "source": "web"
      },
      {
        "title": "Webb's First Deep Field (NIRCam Image) - NASA Science",
        "url": "https://science.nasa.gov/asset/webb/webbs-first-deep-field-nircam-image/",
        "date": "2022-07-12",
        "last_updated": "2026-05-16",
        "snippet": "Webb's image has fully revealed their bright cores, which are filled with stars, along with orange star clusters along their edges. Not all galaxies in this ...",
        "source": "web"
      },
      {
        "title": "Deepest Ever Deep Field. Where Are The Limits of James Webb?",
        "url": "https://www.youtube.com/watch?v=WdTkH1v2NqI",
        "date": "2024-02-10",
        "last_updated": "2026-05-19",
        "snippet": "... observations and biases 19:53 Breadstick galaxies 31:07 Wen ... James Webb Space Telescope Finally Looked Into Alpha Centauri… What ...",
        "source": "web"
      },
      {
        "title": "James Webb Space Telescope - NASA Science",
        "url": "https://science.nasa.gov/mission/webb/",
        "date": "2023-05-25",
        "last_updated": "2026-05-27",
        "snippet": "Webb is the premier observatory of the next decade, serving thousands of astronomers worldwide. It studies every phase in the history of our Universe.",
        "source": "web"
      },
      {
        "title": "James Webb Space Telescope's First Deep Field Image Is Mind ...",
        "url": "https://www.dailymotion.com/video/x9af4aq",
        "date": "2024-12-07",
        "last_updated": "2025-04-15",
        "snippet": "A deep field image captured by the James Webb Space Telescope is of galaxy cluster SMACS 0723. Credit: NASA, ESA, CSA, and STScI",
        "source": "web"
      }
    ],
    "status": null,
    "type": null,
    "usage": {
      "completion_tokens": 469,
      "cost": {
        "input_tokens_cost": 6e-05,
        "output_tokens_cost": 0.00704,
        "total_cost": 0.0131,
        "citation_tokens_cost": null,
        "reasoning_tokens_cost": null,
        "request_cost": 0.006,
        "search_queries_cost": null
      },
      "prompt_tokens": 20,
      "total_tokens": 489,
      "citation_tokens": null,
      "num_search_queries": null,
      "reasoning_tokens": null,
      "search_context_size": "low"
    }
  }
  ```
</Accordion>

### Filtering Image Domains

Control which image sources are included or excluded:

```python Python SDK theme={null}
from perplexity import Perplexity

client = Perplexity()

# Exclude specific domains (prefix with -)
completion = client.chat.completions.create(
    model="sonar",
    return_images=True,
    image_domain_filter=["-gettyimages.com", "-shutterstock.com"],
    messages=[
        {"role": "user", "content": "What are the defining characteristics of award-winning nature photography?"}
    ]
)

# Include only specific domains
completion = client.chat.completions.create(
    model="sonar",
    return_images=True,
    image_domain_filter=["wikimedia.org", "nasa.gov"],
    messages=[
        {"role": "user", "content": "Describe iconic historical photographs from the 20th century and what each one documents."}
    ]
)
```

<AccordionGroup>
  <Accordion title="Response — What are the defining characteristics of award-winning nature photography?">
    ```json theme={null}
    {
      "id": "009ca52a-40f8-4099-b8b9-530f1713bcb3",
      "choices": [
        {
          "delta": {
            "content": "",
            "role": "assistant",
            "reasoning_steps": null,
            "tool_call_id": null,
            "tool_calls": null
          },
          "index": 0,
          "message": {
            "content": "Award‑winning nature photographs are defined by **strong emotional impact, a clear and original subject/story, excellent composition, and flawless technical execution**, all presented with **authentic, restrained post‑processing**.[1][2][4][5]\n\nKey characteristics judges and editors consistently look for:\n\n1. **Emotional and visual impact**  \n   - The image must **grab attention instantly** and stand out in a field of similar subjects.[1][2][5]  \n   - It typically evokes a strong feeling: awe, serenity, tension, mystery, or curiosity.[1][2]  \n   - Overall “impact” is often scored separately from other criteria in contests.[1][5]\n\n2. **Originality and storytelling**  \n   - Judges value **original perspectives, behavior, or conditions**—not just a technically perfect shot of a common scene.[2][4][5]  \n   - A winning image usually **tells a clear story or suggests one**: survival, vulnerability, power of weather, seasonal change, human–nature relationships, etc.[1][2][4]  \n   - Elements of **mystery** (fog, partial concealment, unusual viewpoints) help keep viewers engaged longer.[2]\n\n3. **Strong, intentional composition**  \n   - There is a **clear point of interest** that the eye goes to first; nothing important competes with it.[1][2][4]  \n   - Use of compositional tools such as:\n     - **Leading lines, framing, and foreground interest** to guide the eye.[1][2]  \n     - Smart use of **rule of thirds / off‑center placement** for dynamism.[1]  \n     - **Simplicity and minimal distractions**—clutter, stray branches, or bright patches are minimized or excluded.[1][2][4]  \n   - Award winners often have a **multi‑layered composition** (foreground, midground, background) or an intentionally minimalist design that feels deliberate.[1][2]\n\n4. **Exceptional use of light**  \n   - Light is rarely “neutral”: it adds **drama, depth, and mood**.[1][2][4]  \n   - Many award‑winning images exploit **golden hour, low‑angle, backlight, side‑light, or storm light** for texture and atmosphere.[1][2]  \n   - Good light also ensures **rich tonal contrast** without losing important detail in shadows or highlights.[1][2]\n\n5. **Technical excellence (craftsmanship)**  \n   - **Critical sharpness** where it matters (eyes in wildlife, key textures in landscapes) and appropriate depth of field.[1][4][5]  \n   - **Accurate, controlled exposure**: no distracting blown highlights, blocked shadows, or excessive noise; use of histogram, bracketing, and manual control is common.[1][4]  \n   - Clean files (no obvious dust spots, halos, or heavy artifacts) and competent handling of motion (freeze vs. blur) that supports the story.[1][4][5]  \n   - Major competitions explicitly score **technical excellence** alongside composition and impact.[5]\n\n6. **Clarity of subject and simplification**  \n   - The frame is **edited in‑camera**: everything included has a purpose.[1][2][4]  \n   - Backgrounds are often simplified using:\n     - **Careful camera position** to avoid bright or messy areas.[1][2]  \n     - **Shallow depth of field** in wildlife/close‑up to isolate the subject.[1]  \n   - Distractions may be controlled later via cropping, as long as the crop supports balance and “breathing room.”[1][2]\n\n7. **Thoughtful, restrained post‑processing**  \n   - Editing **enhances but does not overwhelm** the natural look of the scene.[1][4]  \n   - Judges tend to reject images with **obvious over‑saturation, heavy filters, or unrealistic colors/contrast** in nature categories.[1]  \n   - Many contests stress staying **true to reality** in nature and wildlife divisions, within reasonable artistic latitude.[1][3][6]\n\n8. **Personal vision and fine‑art quality**  \n   - Top‑tier award work shows a **consistent personal style or vision**, not just one lucky frame.[3]  \n   - Organizations like NANPA emphasize **mastery of both artistic and technical aspects** and the ability to create images that are not only beautiful but also **inspire appreciation for nature**.[3]  \n   - This often means a recognizable approach to mood, color palette, composition, or subject choice across a body of work.[3]\n\n9. **Subject choice and significance**  \n   - The subject is often **visually or biologically compelling**: rare behavior, pristine or fragile habitats, dramatic weather, or subtle, intimate scenes that reveal nature in a new way.[1][4][7]  \n   - Strong images frequently **communicate something unique, informative, or thought‑provoking** about the natural world, not just its surface beauty.[4][6]\n\n10. **Ethical and contextual suitability**  \n   - For major contests, nature/wildlife images must typically be of **wild, non‑captive animals in natural settings** and adhere to ethical guidelines.[6]  \n   - Authenticity of behavior and habitat, and respect for the subject and environment, are increasingly part of what makes an image award‑worthy in respected competitions.[3][6]\n\nIf you’d like, I can translate these characteristics into a practical checklist you can use when shooting or editing, or analyze a sample image (described or uploaded) against these criteria.",
            "role": "assistant",
            "reasoning_steps": null,
            "tool_call_id": null,
            "tool_calls": null
          },
          "finish_reason": "stop"
        }
      ],
      "created": 1779896043,
      "model": "sonar-pro",
      "citations": [
        "https://visualwilderness.com/q-and-a/how-to-capture-award-winning-nature-photographs",
        "https://www.meghanmaloneyphotography.co.nz/post/5-tips-for-an-award-winning-landscape-photo",
        "https://nanpa.org/contests-and-awards/career-awards/fine-art-in-nature-photography/",
        "https://coloradooutdoorsmag.com/2025/12/04/what-makes-a-great-nature-photograph/",
        "https://www.youtube.com/watch?v=DKnfgF-Ee0w",
        "https://en.wikipedia.org/wiki/Nature_photography",
        "https://www.worldnaturephotographyawards.com/winners-2026",
        "https://newyorkphotographyawards.com/nature-photography-awards.php",
        "https://globalphotographyawards.com/nature-photography-awards.php"
      ],
      "object": "chat.completion",
      "search_results": [
        {
          "title": "How to Capture Award Winning Nature Photographs",
          "url": "https://visualwilderness.com/q-and-a/how-to-capture-award-winning-nature-photographs",
          "date": "2024-12-14",
          "last_updated": "2025-10-23",
          "snippet": "Whether you're shooting for a competition, a portfolio, or personal satisfaction, winning nature photographs share a few common characteristics.",
          "source": "web"
        },
        {
          "title": "5 tips for capturing an award-winning landscape photo",
          "url": "https://www.meghanmaloneyphotography.co.nz/post/5-tips-for-an-award-winning-landscape-photo",
          "date": "2026-04-16",
          "last_updated": "2025-05-09",
          "snippet": "Award-winning images will combine a strong or unusual composition with interesting lighting to great effect without any distractions allowing ...",
          "source": "web"
        },
        {
          "title": "Fine Art in Nature Photography award - NANPA",
          "url": "https://nanpa.org/contests-and-awards/career-awards/fine-art-in-nature-photography/",
          "date": "2026-04-22",
          "last_updated": "2026-04-30",
          "snippet": "Commitment to achieving a positive impact upon nature photography through the creation of fine art imagery; and · Dedication to educate/instruct other nature ...",
          "source": "web"
        },
        {
          "title": "What makes a great nature photograph? - Colorado Outdoors Online",
          "url": "https://coloradooutdoorsmag.com/2025/12/04/what-makes-a-great-nature-photograph/",
          "date": "2025-12-04",
          "last_updated": "2025-12-20",
          "snippet": "The simple answer would be that a great photograph is a combination of subject matter, lighting, composition, technical expertise and gear ...",
          "source": "web"
        },
        {
          "title": "How-To Win A Nature Photo Contest - YouTube",
          "url": "https://www.youtube.com/watch?v=DKnfgF-Ee0w",
          "date": "2010-03-30",
          "last_updated": "2026-05-18",
          "snippet": "Visit http://bit.ly/13zURQP to enter! You don't have to be a pro to take great pictures of nature and wildlife. Get tips from the experts at ...",
          "source": "web"
        },
        {
          "title": "Nature photography - Wikipedia",
          "url": "https://en.wikipedia.org/wiki/Nature_photography",
          "date": "2006-09-06",
          "last_updated": "2026-05-10",
          "snippet": "Nature photography encompasses a wide range of photography taken outdoors and devoted to displaying natural elements such as landscapes, wildlife, plants, and ...",
          "source": "web"
        },
        {
          "title": "Winners 2026 - world nature photography awards",
          "url": "https://www.worldnaturephotographyawards.com/winners-2026",
          "date": null,
          "last_updated": "2026-05-22",
          "snippet": "Golden autumn colours explode in this intimate portrait of an incredible, lichen-laden elder birch in full seasonal display — bold, brilliant, and full of ...",
          "source": "web"
        },
        {
          "title": "Nature Photography Awards",
          "url": "https://newyorkphotographyawards.com/nature-photography-awards.php",
          "date": "2025-10-02",
          "last_updated": "2025-10-19",
          "snippet": "The Nature Photography award category at the 2026 New York Photography Awards celebrates the beauty and wonder of the natural world.",
          "source": "web"
        },
        {
          "title": "Nature Photography",
          "url": "https://globalphotographyawards.com/nature-photography-awards.php",
          "date": "2021-01-01",
          "last_updated": "2025-10-18",
          "snippet": "The International Nature Photography Awards is a celebration of the natural world in all its wild beauty and diversity.",
          "source": "web"
        }
      ],
      "status": null,
      "type": null,
      "usage": {
        "completion_tokens": 1177,
        "cost": {
          "input_tokens_cost": 4e-05,
          "output_tokens_cost": 0.01766,
          "total_cost": 0.02369,
          "citation_tokens_cost": null,
          "reasoning_tokens_cost": null,
          "request_cost": 0.006,
          "search_queries_cost": null
        },
        "prompt_tokens": 12,
        "total_tokens": 1189,
        "citation_tokens": null,
        "num_search_queries": null,
        "reasoning_tokens": null,
        "search_context_size": "low"
      }
    }
    ```
  </Accordion>

  <Accordion title="Response — Describe iconic historical photographs from the 20th century and what each one documents.">
    ```json theme={null}
    {
      "id": "5eb4459b-e477-421d-960a-4bea51d37556",
      "choices": [
        {
          "delta": {
            "content": "",
            "role": "assistant",
            "reasoning_steps": null,
            "tool_call_id": null,
            "tool_calls": null
          },
          "index": 0,
          "message": {
            "content": "Here are several **iconic 20th-century historical photographs** and what each one documents:\n\n- **Earthrise** (1968, Bill Anders) — documents the first color photograph of Earth taken from space, and became a powerful symbol of the planet’s fragility and the environmental movement.[2]\n- **Raising the Flag on Iwo Jima** (1945, Joe Rosenthal) — documents U.S. Marines raising the American flag atop Mount Suribachi during the Battle of Iwo Jima in World War II.[1][2]\n- **V-J Day in Times Square** (“The Kiss,” 1945, Alfred Eisenstaedt) — documents a jubilant kiss between a sailor and a nurse in New York on the day Japan’s surrender marked the end of World War II.[1][4]\n- **Migrant Mother** (1936, Dorothea Lange) — documents Florence Owens Thompson and her children during the Great Depression, becoming an emblem of Depression-era hardship.[1][6][8]\n- **Napalm Girl** / **The Terror of War** (1972, Nick Ut) — documents the horror of the Vietnam War through the image of a severely burned child fleeing a napalm attack.[1][3]\n- **Tank Man** (1989, unidentified photographers, widely circulated from multiple sources) — documents a lone protester standing in front of tanks after the crackdown in Tiananmen Square, becoming a symbol of resistance.[6]\n- **Little Rock integration photograph** (“The Scream Image,” 1957, often associated with news photographer Will Counts) — documents Elizabeth Eckford being harassed by white students while integrating Central High School, and became a key Civil Rights Movement image.[2]\n- **Raising a Soviet flag over the Reichstag** (1945, Yevgeny Khaldei) — documents the Soviet capture of Berlin and the symbolic fall of Nazi Germany.[5]\n- **The Hindenburg disaster** (1937, news photographers including Sam Shere) — documents the airship bursting into flames as it attempted to land, marking a dramatic end to the zeppelin era.[5]\n- **The “Breaker Boys” photographs** (early 1900s, Lewis Hine) — document child labor in coal mines and helped build support for labor reform.[2]\n- **The first powered flight at Kitty Hawk** (1903, Wilbur and Orville Wright photo sequence) — documents the Wright brothers’ first successful airplane flight.[2]\n- **The execution of Nguyễn Văn Lém** / “Saigon Execution” (1968, Eddie Adams) — documents a South Vietnamese police chief shooting a prisoner during the Tet Offensive, becoming one of the defining images of the Vietnam War.[3]\n- **The Burning Monk** (1963, Malcolm Browne) — documents Buddhist monk Thích Quảng Đức’s self-immolation in protest against the South Vietnamese government.[6]\n\nIf you want, I can turn this into a **decade-by-decade timeline** or give you a **shorter top 10 list with one-line descriptions**.",
            "role": "assistant",
            "reasoning_steps": null,
            "tool_call_id": null,
            "tool_calls": null
          },
          "finish_reason": "stop"
        }
      ],
      "created": 1779896037,
      "model": "sonar-pro",
      "citations": [
        "https://www.artisera.com/blogs/expressions/10-most-iconic-photographs-of-the-20th-century-from-around-the-world",
        "https://historyfacts.com/arts-culture/article/iconic-photos-from-each-decade-of-the-20th-century/",
        "https://www.digitalphotomentor.com/20-most-famous-photographs/",
        "https://historycollection.com/20th-century-photos-that-changed-the-world/",
        "https://www.youtube.com/watch?v=YFNpff9W-BE",
        "https://rarehistoricalphotos.com/100-influential-historical-pictures-all-time/",
        "https://en.wikipedia.org/wiki/List_of_photographs_considered_the_most_important",
        "https://seanchase.wordpress.com/2018/09/25/unforgettable-photographs-of-the-20th-century-immortal-images-of-social-historical-significance/",
        "https://www.life.com/history/the-100-most-important-photos-ever/",
        "https://www.gettyimages.com/photos/20th-century"
      ],
      "object": "chat.completion",
      "search_results": [
        {
          "title": "10 Most Iconic Photographs of the 20th Century From ... - Artisera",
          "url": "https://www.artisera.com/blogs/expressions/10-most-iconic-photographs-of-the-20th-century-from-around-the-world",
          "date": "2020-03-24",
          "last_updated": "2026-03-04",
          "snippet": "1. Gandhi and the Spinning Wheel by Margaret Bourke-White, 1946 · 2. Starving Child and Vulture by Kevin Carter, 1993 · 3. The Terror of War by ...",
          "source": "web"
        },
        {
          "title": "Iconic Photos From Each Decade of the 20th Century - History Facts",
          "url": "https://historyfacts.com/arts-culture/article/iconic-photos-from-each-decade-of-the-20th-century/",
          "date": "2024-08-29",
          "last_updated": "2026-04-08",
          "snippet": "Here are some of the most iconic photos from each decade of the last century, from Kitty Hawk, North Carolina, to the far-flung reaches of the universe.",
          "source": "web"
        },
        {
          "title": "20 of the Most Famous Photographs in History - Learn the Backstory",
          "url": "https://www.digitalphotomentor.com/20-most-famous-photographs/",
          "date": "2018-05-14",
          "last_updated": "2025-07-06",
          "snippet": "#1 Henri Cartier-Bresson's famous photo Man Jumping the Puddle | 1930 · #2 The famous photo The Steerage by Alfred Stieglitz | 1907 · #3 Stanley ...",
          "source": "web"
        },
        {
          "title": "20th Century Photos That Changed the World - History Collection",
          "url": "https://historycollection.com/20th-century-photos-that-changed-the-world/",
          "date": "2018-08-23",
          "last_updated": "2026-03-15",
          "snippet": "They cover themes of war and politics, love and hate, peace and violence as well as life and death. These photos achieved both national and international fame ...",
          "source": "web"
        },
        {
          "title": "20 ICONIC Photos of the 20TH Century - YouTube",
          "url": "https://www.youtube.com/watch?v=YFNpff9W-BE",
          "date": "2018-03-02",
          "last_updated": "2025-12-26",
          "snippet": "A lot has happened all over the world in the 20th century. Today, we present some of the most iconic photos that defined the last century.",
          "source": "web"
        },
        {
          "title": "The 100 Most Influential Historical Pictures of All Time",
          "url": "https://rarehistoricalphotos.com/100-influential-historical-pictures-all-time/",
          "date": "2021-03-08",
          "last_updated": "2026-03-05",
          "snippet": "TIME magazine decided to create a list of the 100 most influential pictures ever taken. They teamed up with curators, historians, photo editors, and famous ...",
          "source": "web"
        },
        {
          "title": "List of photographs considered the most important - Wikipedia",
          "url": "https://en.wikipedia.org/wiki/List_of_photographs_considered_the_most_important",
          "date": "2017-08-02",
          "last_updated": "2026-05-20",
          "snippet": "These images may be referred to as the most important, most iconic, or most influential—and are considered key images in the history of photography.",
          "source": "web"
        },
        {
          "title": "Unforgettable Photographs of the 20th Century: Immortal Images of ...",
          "url": "https://seanchase.wordpress.com/2018/09/25/unforgettable-photographs-of-the-20th-century-immortal-images-of-social-historical-significance/",
          "date": "2018-09-25",
          "last_updated": "2025-11-10",
          "snippet": "Collected here are some of the most iconic and socially significant photographs of the 20th Century and the stories behind them.",
          "source": "web"
        },
        {
          "title": "The 100 Most Important Photos Ever - LIFE",
          "url": "https://www.life.com/history/the-100-most-important-photos-ever/",
          "date": "2021-12-07",
          "last_updated": "2026-04-12",
          "snippet": "In our quest to select the most important 100 photographs ever, we looked for pictures that demonstrated something important and meaningful.",
          "source": "web"
        },
        {
          "title": "14591541 20th Century Stock Photos, High-Res Pictures, and Images",
          "url": "https://www.gettyimages.com/photos/20th-century",
          "date": "2005-08-31",
          "last_updated": "2025-04-10",
          "snippet": "Browse 14,591,541 authentic 20th century stock photos, high-res images, and pictures, or explore additional 20th century doctor or farm family 20th century ...",
          "source": "web"
        }
      ],
      "status": null,
      "type": null,
      "usage": {
        "completion_tokens": 638,
        "cost": {
          "input_tokens_cost": 5e-05,
          "output_tokens_cost": 0.00957,
          "total_cost": 0.01562,
          "citation_tokens_cost": null,
          "reasoning_tokens_cost": null,
          "request_cost": 0.006,
          "search_queries_cost": null
        },
        "prompt_tokens": 17,
        "total_tokens": 655,
        "citation_tokens": null,
        "num_search_queries": null,
        "reasoning_tokens": null,
        "search_context_size": "low"
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### Filtering Image Formats

Restrict results to specific file formats:

```python Python SDK theme={null}
from perplexity import Perplexity

client = Perplexity()

# Only return GIF images
completion = client.chat.completions.create(
    model="sonar",
    return_images=True,
    image_format_filter=["gif"],
    messages=[
        {"role": "user", "content": "Explain how transformer self-attention works using a step-by-step conceptual walkthrough."}
    ]
)

# Allow multiple formats
completion = client.chat.completions.create(
    model="sonar",
    return_images=True,
    image_format_filter=["jpeg", "png", "webp"],
    messages=[
        {"role": "user", "content": "Show me images of the Eiffel Tower at night."}
    ]
)
```

<AccordionGroup>
  <Accordion title="Response — Explain how transformer self-attention works using a step-by-step conceptual walkthrough.">
    ```json theme={null}
    {
      "id": "c1b191ba-f6a9-4e4e-8c09-fcc3c1c85638",
      "choices": [
        {
          "delta": {
            "content": "",
            "role": "assistant",
            "reasoning_steps": null,
            "tool_call_id": null,
            "tool_calls": null
          },
          "index": 0,
          "message": {
            "content": "Transformer **self-attention** lets each token in a sequence look at the other tokens and decide which ones matter most for updating its own representation.[1][2] Conceptually, it turns a sentence into a set of context-aware vectors by computing weighted averages of the sequence based on similarity scores.[1][3]\n\nHere is the step-by-step walkthrough:\n\n1. **Start with token embeddings**  \n   Each word or token is first converted into a vector embedding that the model can process numerically.[2][5]\n\n2. **Create Query, Key, and Value vectors**  \n   For each token, the model applies learned linear transformations to produce three vectors: **Query (Q)**, **Key (K)**, and **Value (V)**.[1][2][5]\n\n3. **Compare each query with all keys**  \n   A token’s query is compared with every token’s key, usually by dot product, to produce attention scores that measure relevance.[1][3]\n\n4. **Scale the scores**  \n   The scores are divided by \\(\\sqrt{d_k}\\), where \\(d_k\\) is the key dimension, to keep values numerically stable during training.[1][2][5]\n\n5. **Convert scores into probabilities**  \n   A softmax function turns the scaled scores into attention weights that sum to 1, so the model can interpret them as relative importance values.[1][2][5]\n\n6. **Use the weights to mix the values**  \n   The attention weights are applied to the value vectors, and the weighted sum becomes the new representation for that token.[1][3][5]\n\n7. **Repeat for every token in parallel**  \n   Each token gets its own contextualized output, and transformer self-attention can do this for all positions at once rather than sequentially.[1][3]\n\nA compact intuition is: **Query = what I’m looking for**, **Key = what I contain**, and **Value = the information I will pass along if selected**.[2][5] The result is that each token representation becomes context-aware, which helps the model capture relationships like long-range dependencies and word meaning from surrounding context.[1][3]\n\nIn **multi-head attention**, the model runs several self-attention operations in parallel with different learned projections, then combines their outputs; this lets it capture different kinds of relationships at the same time.[1][3]",
            "role": "assistant",
            "reasoning_steps": null,
            "tool_call_id": null,
            "tool_calls": null
          },
          "finish_reason": "stop"
        }
      ],
      "created": 1779896040,
      "model": "sonar-pro",
      "citations": [
        "https://www.geeksforgeeks.org/nlp/self-attention-in-nlp/",
        "https://www.ibm.com/think/topics/self-attention",
        "https://uvadlc-notebooks.readthedocs.io/en/latest/tutorial_notebooks/tutorial6/Transformers_and_MHAttention.html",
        "https://www.youtube.com/watch?v=eMlx5fFNoYc&vl=en",
        "https://sebastianraschka.com/blog/2023/self-attention-from-scratch.html",
        "https://www.youtube.com/watch?v=KMHkbXzHn7s",
        "https://www.deeplearning.ai/courses/attention-in-transformers-concepts-and-code-in-pytorch"
      ],
      "object": "chat.completion",
      "search_results": [
        {
          "title": "Self - Attention in NLP - GeeksforGeeks",
          "url": "https://www.geeksforgeeks.org/nlp/self-attention-in-nlp/",
          "date": "2026-04-01",
          "last_updated": "2026-05-26",
          "snippet": "It works by first understanding the input and then generating the corresponding output based on that understanding. Encoder: It takes the input ...",
          "source": "web"
        },
        {
          "title": "What is self-attention? | IBM",
          "url": "https://www.ibm.com/think/topics/self-attention",
          "date": "2025-02-18",
          "last_updated": "2026-03-31",
          "snippet": "The transformer architecture includes a self-attention layer where the attention process is integrated. The steps are explained as presented in the paper by ...",
          "source": "web"
        },
        {
          "title": "Tutorial 6: Transformers and Multi-Head Attention",
          "url": "https://uvadlc-notebooks.readthedocs.io/en/latest/tutorial_notebooks/tutorial6/Transformers_and_MHAttention.html",
          "date": null,
          "last_updated": "2026-04-28",
          "snippet": "In contrast to recurrent networks, the self-attention layer can parallelize all its operations making it much faster to execute for smaller sequence lengths.",
          "source": "web"
        },
        {
          "title": "Attention in transformers, step-by-step | Deep Learning Chapter 6",
          "url": "https://www.youtube.com/watch?v=eMlx5fFNoYc&vl=en",
          "date": "2024-04-07",
          "last_updated": "2026-05-26",
          "snippet": "I'm a university lecturer with a PhD in AI, and I cannot compete with the quality of this work. Videos like this put the entire higher ...",
          "source": "web"
        },
        {
          "title": "Understanding and Coding the Self-Attention Mechanism of Large ...",
          "url": "https://sebastianraschka.com/blog/2023/self-attention-from-scratch.html",
          "date": "2023-02-09",
          "last_updated": "2026-05-26",
          "snippet": "In self-attention, we work with the same input sequence. In cross-attention, we mix or combine two different input sequences. In the case of the ...",
          "source": "web"
        },
        {
          "title": "How Attention Mechanism Works in Transformer Architecture",
          "url": "https://www.youtube.com/watch?v=KMHkbXzHn7s",
          "date": "2025-03-08",
          "last_updated": "2026-05-27",
          "snippet": "... attention in transformers is self-attention, where each token in a sequence attends to all other tokens, capturing long-range dependencies ...",
          "source": "web"
        },
        {
          "title": "Attention in Transformers: Concepts and Code in PyTorch",
          "url": "https://www.deeplearning.ai/courses/attention-in-transformers-concepts-and-code-in-pytorch",
          "date": "2025-02-12",
          "last_updated": "2026-05-26",
          "snippet": "Learn the difference between self-attention, masked self-attention, and cross-attention, and how multi-head attention scales the algorithm. About this course.",
          "source": "web"
        }
      ],
      "status": null,
      "type": null,
      "usage": {
        "completion_tokens": 486,
        "cost": {
          "input_tokens_cost": 5e-05,
          "output_tokens_cost": 0.00729,
          "total_cost": 0.01334,
          "citation_tokens_cost": null,
          "reasoning_tokens_cost": null,
          "request_cost": 0.006,
          "search_queries_cost": null
        },
        "prompt_tokens": 17,
        "total_tokens": 503,
        "citation_tokens": null,
        "num_search_queries": null,
        "reasoning_tokens": null,
        "search_context_size": "low"
      }
    }
    ```
  </Accordion>

  <Accordion title="Response — Show me images of the Eiffel Tower at night.">
    ```json theme={null}
    {
      "id": "1b0da5ef-c044-4c74-b88f-c5cc15c1459e",
      "choices": [
        {
          "delta": {
            "content": "",
            "role": "assistant",
            "reasoning_steps": null,
            "tool_call_id": null,
            "tool_calls": null
          },
          "index": 0,
          "message": {
            "content": "Here are some image sources for the Eiffel Tower at night:\n\n1. iStock: Eiffel Tower Night Images and Stock Photos  \n   https://www.istockphoto.com/photos/eiffel-tower-night\n\n2. Getty Images: Eiffel Tower Night Stock Photos  \n   https://www.gettyimages.com/photos/eiffel-tower-night\n\n3. Adobe Stock: Eiffel Tower Night Search Results  \n   https://stock.adobe.com/search?k=eiffel+tower+night\n\n4. Tripadvisor: Eiffel Tower Tour by Night photo  \n   https://www.tripadvisor.com/LocationPhotoDirectLink-g187147-d11449765-i423267412-Eiffel_Tower_Tour_by_Night-Paris_Ile_de_France.html\n\n5. French Moments: The Eiffel Tower by Night  \n   https://frenchmoments.eu/the-eiffel-tower-by-night/\n\nIf you want, I can also help you find:\n- free-to-use images,\n- high-resolution wallpapers,\n- or a few especially beautiful night photos.",
            "role": "assistant",
            "reasoning_steps": null,
            "tool_call_id": null,
            "tool_calls": null
          },
          "finish_reason": "stop"
        }
      ],
      "created": 1779391773,
      "model": "sonar-pro",
      "citations": [
        "https://www.istockphoto.com/photos/eiffel-tower-night",
        "https://www.toureiffel.paris/en/news/history-and-culture/everything-you-need-know-about-eiffel-tower-night",
        "https://www.gettyimages.com/photos/eiffel-tower-night",
        "https://stock.adobe.com/search?k=eiffel+tower+night",
        "https://www.tripadvisor.com/LocationPhotoDirectLink-g187147-d11449765-i423267412-Eiffel_Tower_Tour_by_Night-Paris_Ile_de_France.html",
        "https://frenchmoments.eu/the-eiffel-tower-by-night/"
      ],
      "object": "chat.completion",
      "search_results": [
        {
          "title": "3661 Eiffel Tower Night Images and Stock Photos - iStock",
          "url": "https://www.istockphoto.com/photos/eiffel-tower-night",
          "date": "2024-04-02",
          "last_updated": "2026-03-07",
          "snippet": "Search from 3661 Eiffel Tower Night stock photos, pictures and royalty-free images from iStock. Get iStock exclusive photos, illustrations, and more.",
          "source": "web"
        },
        {
          "title": "Everything you need to know about the Eiffel Tower at night",
          "url": "https://www.toureiffel.paris/en/news/history-and-culture/everything-you-need-know-about-eiffel-tower-night",
          "date": "2020-04-09",
          "last_updated": "2026-05-05",
          "snippet": "Photographing the Eiffel Tower at night is not illegal at all. Any individual can take photos and share them on social networks. But the ...",
          "source": "web"
        },
        {
          "title": "4138 Eiffel Tower Night Stock Photos, High-Res Pictures, and Images",
          "url": "https://www.gettyimages.com/photos/eiffel-tower-night",
          "date": "2016-12-19",
          "last_updated": "2025-04-12",
          "snippet": "Browse 4,138 authentic eiffel tower night stock photos, high-res images, and pictures, or explore additional eiffel tower night lights or eiffel tower night ...",
          "source": "web"
        },
        {
          "title": "16678 results for eiffel tower night in all - Adobe Stock",
          "url": "https://stock.adobe.com/search?k=eiffel+tower+night",
          "date": null,
          "last_updated": null,
          "snippet": "Search from thousands of royalty-free Eiffel Tower Night stock images and video for your next project. Download royalty-free stock photos, vectors, ...",
          "source": "web"
        },
        {
          "title": "Picture of Eiffel Tower Tour by Night, Paris - Tripadvisor",
          "url": "https://www.tripadvisor.com/LocationPhotoDirectLink-g187147-d11449765-i423267412-Eiffel_Tower_Tour_by_Night-Paris_Ile_de_France.html",
          "date": "2026-02-24",
          "last_updated": "2026-02-24",
          "snippet": "Eiffel Tower Tour by Night, Paris Picture: Eiffel Tower at night - Check out Tripadvisor members' 50079 candid photos and videos of Eiffel Tower Tour by ...",
          "source": "web"
        },
        {
          "title": "The Eiffel Tower by Night: A Photographer's Dream - French Moments",
          "url": "https://frenchmoments.eu/the-eiffel-tower-by-night/",
          "date": "2024-04-17",
          "last_updated": "2026-05-19",
          "snippet": "Selfies, group photos, and creative shots juxtaposing the tower's lights with the city's landmarks are all part of the experience. As you stand ...",
          "source": "web"
        }
      ],
      "status": null,
      "type": null,
      "usage": {
        "completion_tokens": 223,
        "cost": {
          "input_tokens_cost": 4e-05,
          "output_tokens_cost": 0.00334,
          "total_cost": 0.00938,
          "citation_tokens_cost": null,
          "reasoning_tokens_cost": null,
          "request_cost": 0.006,
          "search_queries_cost": null
        },
        "prompt_tokens": 13,
        "total_tokens": 236,
        "citation_tokens": null,
        "num_search_queries": null,
        "reasoning_tokens": null,
        "search_context_size": "low"
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### Key Parameters

* **`return_images`**: Set to `true` to enable image returns
* **`image_domain_filter`**: Array of domains (max 10 entries). Prefix with `-` to exclude (e.g., `-gettyimages.com`)
* **`image_format_filter`**: Array of lowercase file extensions (max 10 entries). Use `gif`, `jpeg`, `png`, `webp` (no dot prefix)
* **Limitations**: Maximum 30 images per response, filters only apply when `return_images: true`

## Receiving Videos

Enable video returns in responses using the `media_response.overrides.return_videos` parameter.

<Info>
  The `return_videos` feature is currently only available in the Sonar API.
</Info>

<Warning>
  Video returns may increase response size and processing time. Use this feature selectively for queries where video content adds significant value.
</Warning>

### Basic Video Returns

```python Python SDK theme={null}
from perplexity import Perplexity

client = Perplexity()

completion = client.chat.completions.create(
    model="sonar-pro",
    media_response={
        "overrides": {
            "return_videos": True
        }
    },
    messages=[
        {"role": "user", "content": "Describe the history of the modern Winter Olympic Games from 1924 to today."}
    ]
)
print(completion.choices[0].message.content)
```

<Accordion title="Response">
  ```json theme={null}
  {
    "id": "2c258952-4e5c-470e-90b6-10a8c206a58f",
    "choices": [
      {
        "delta": {
          "content": "",
          "role": "assistant",
          "reasoning_steps": null,
          "tool_call_id": null,
          "tool_calls": null
        },
        "index": 0,
        "message": {
          "content": "The modern Winter Olympic Games began with **Chamonix 1924** and have evolved from a small European-focused festival of six sports into a global mega-event featuring more than 100 medal events, thousands of athletes, and over 90 nations, held on a separate four‑year cycle from the Summer Games since **1994**.[1][3]\n\nBelow is a concise chronological overview, focusing on major milestones in hosting, political context, program changes, and structural reforms.\n\n---\n\n### Origins and early years (1924–1936)\n\n- **Pre‑1924 background**  \n  Winter sports such as **figure skating** and **ice hockey** appeared sporadically at the Summer Olympics (e.g., 1920 Antwerp).[1][3] Growing popularity of skiing and skating in Europe and North America led the IOC to support a dedicated “**International Winter Sports Week**” in France in 1924.[1][3]\n\n- **1924 – Chamonix, France (retroactively I Winter Olympics)**  \n  Organized as “International Winter Sports Week” under IOC patronage, later designated the first Winter Olympic Games.[1][3]  \n  - About **258 athletes** (247 men, 11 women) from **16 nations**.[3]  \n  - **Six sports/16 events**: bobsleigh, curling, figure skating, ice hockey, speed skating, and Nordic skiing (cross‑country, ski jumping, Nordic combined).[1][3]  \n  - Established the basic model for a separate Winter Games tradition.[1][3]\n\n- **Creation of a separate Winter Olympic Games**  \n  In **1925**, the IOC formally created a distinct **Olympic Winter Games**, retroactively recognizing Chamonix 1924 as the first edition and awarding **St. Moritz, Switzerland** the 1928 Games.[1]\n\n- **1928 – St. Moritz, Switzerland**  \n  First Games officially organized as “Olympic Winter Games.”[1] St. Moritz’s alpine setting helped solidify the image of a mountain-based winter festival.\n\n- **1932 – Lake Placid, USA**  \n  First Winter Olympics held **outside Europe**, signaling early global expansion beyond the European core.[1]\n\n- **1936 – Garmisch‑Partenkirchen, Germany**  \n  - Hosted in Nazi Germany, mirroring the propaganda context of the 1936 Berlin Summer Games.  \n  - **Alpine skiing** was added to the Olympic winter program, marking the rise of modern downhill ski disciplines.[2]\n\n---\n\n### War interruption and postwar consolidation (1940–1960)\n\n- **Cancellations during World War II**  \n  Winter Games scheduled for **1940** and **1944** were **canceled** due to the war, interrupting the four‑year cycle.[1]\n\n- **1948 – St. Moritz, Switzerland**  \n  First postwar Winter Olympics, held in neutral Switzerland.[1] Germany and Japan, excluded from the 1948 Summer Games, also did not participate in these early postwar events.\n\n- **1952 – Oslo, Norway**  \n  The Games returned to Scandinavia, the birthplace of many Nordic skiing traditions.[1]\n\n- **1956 – Cortina d’Ampezzo, Italy**  \n  Marked increased television interest and laid groundwork for the media‑driven growth of later Games.[1]\n\n- **1960 – Squaw Valley (now Palisades Tahoe), USA**  \n  - Showcased extensive **television coverage**, accelerating commercialization and global visibility.  \n  - **Biathlon**—combining cross‑country skiing and rifle shooting, derived from the older “military patrol” event—was added as a medal sport.[2][3]\n\n---\n\n### Expansion of venues and sports (1960s–1980s)\n\n- **1964 – Innsbruck, Austria**  \n  - Hosted amid concerns over snow conditions, prompting large‑scale snow storage and transport efforts—an early example of climate-related operational challenges.  \n  - **Luge** was added to the Winter Olympic program.[2]\n\n- **1968, 1972, 1976**  \n  While specific host cities are not detailed in the provided sources, this era saw:  \n  - Growth in the number of participating nations and events.  \n  - Rising television revenues, making the Games financially significant for hosts and the IOC.[1]\n\n- **1980 – Lake Placid, USA (second time)**  \n  Known historically for iconic moments like the “Miracle on Ice” (noted widely in Olympic histories, though not in the cited pages), and increased Cold War symbolism around East–West rivalry in winter sports.\n\n- **1984 – Sarajevo, Yugoslavia**  \n  First Winter Games in a socialist, non‑aligned country; later remembered against the backdrop of the 1990s Balkan conflicts.\n\n- **1988 – Calgary, Canada**  \n  - Marked a major step in **commercialization** and large‑scale broadcast production for winter sports.[1]  \n  - **Freestyle skiing** and **short track speed skating** appeared as **demonstration sports**, foreshadowing program shifts toward more dynamic, TV‑friendly events.[2]\n\n---\n\n### Separation from the Summer Games and new disciplines (1990s)\n\n- **Until 1992**  \n  Winter and Summer Games were held in the **same year** every four years.[1][3]\n\n- **IOC reform (1986)**  \n  At the **91st IOC Session (1986)**, members decided to **separate** the Summer and Winter Games onto **staggered four‑year cycles in different even‑numbered years**.[1] The aims were to:  \n  - Spread logistical and financial demands.  \n  - Generate steady **broadcast and sponsorship revenue** by holding Olympics every two years (alternating Winter/Summer).[1][3]\n\n- **1992 – Albertville, France**  \n  Last Winter Olympics held in the same year as a Summer Games.[1]  \n  - **Short track speed skating** and **moguls** (freestyle skiing) became official medal events after their demonstration in 1988.[2]\n\n- **1994 – Lillehammer, Norway**  \n  - First Winter Games held **two years after** the previous edition, inaugurating the new staggered cycle.[1][3]  \n  - **Aerials** in freestyle skiing became a medal event, expanding the freestyle program.[2]  \n  - Lillehammer became a reference point for “human‑scale” Games with strong environmental and cultural branding.\n\n- **1998 – Nagano, Japan**  \n  - First Winter Olympics in Asia since Sapporo 1972 (noted in broader histories).  \n  - **Snowboarding** debuted as an Olympic sport (giant slalom and halfpipe), reflecting the rise of youth and action sports.[2]  \n  - **Curling**, present in 1924 then dropped, returned as a full medal sport.[2][3]\n\n---\n\n### Commercial mega-event and action sports era (2000s–2010s)\n\n- **2002 – Salt Lake City, USA**  \n  - Marked by post‑9/11 security concerns and extensive broadcast coverage.  \n  - **Skeleton** was reintroduced as a permanent Olympic winter sport after an earlier appearance in 1928 and 1948.[2]\n\n- **2006 – Torino, Italy**  \n  - Added **snowboard cross** (boardercross) and a **mass start** event in **biathlon**, illustrating how new formats are used to keep sports television‑friendly and exciting.[2]\n\n- **2010 – Vancouver, Canada**  \n  - Introduced **ski cross** in freestyle skiing.[2]  \n  - Featured large urban celebrations and further integrated digital media, social networking, and high‑definition broadcasts.\n\n- **2014 – Sochi, Russia**  \n  - Marked a significant expansion of “action sports” and new team formats:  \n    - **Ski slopestyle**, **snowboard slopestyle**, and **ski halfpipe** were added (men’s and women’s).[2]  \n    - A **team figure skating** event debuted.[2]  \n  - Record‑level spending on venues and infrastructure; geopolitical tensions and human‑rights debates framed international discussion of the Games (noted in many contemporary reports beyond the cited pages).\n\n- **2018 – PyeongChang, South Korea**  \n  - Added **mixed doubles curling**, **snowboard big air**, and **speed skating mass start** events.[2]  \n  - Continued the trend toward **mixed‑gender** and **spectator‑friendly** formats, aligning with the IOC’s push for gender balance and youth appeal.[2]\n\n---\n\n### Recent developments and future direction (2020s)\n\n- **2022 – Beijing, China**  \n  - Beijing became the first city to host both Summer (2008) and Winter Olympics.  \n  - The Games took place during the COVID‑19 era with extensive health protocols (context drawn from general Olympic coverage, though not explicit in the cited pages).  \n  - New events included **women’s monobob**, **mixed team aerials** (freestyle skiing), and a **mixed team relay in short track**, further expanding mixed‑gender and women’s events.[2]\n\n- **2026 – Milano Cortina, Italy (upcoming)**  \n  - Represents a multi‑city, region‑based model using existing and renovated venues across northern Italy.  \n  - Program changes include:  \n    - New **sport**: **ski mountaineering** added to the Winter Olympic program for the first time.[2]  \n    - New or expanded events such as **women’s doubles in luge**, **women’s individual large hill in ski jumping**, a **mixed team event in skeleton**, and **dual moguls** in freestyle skiing.[2]  \n  - These changes underscore ongoing efforts to balance tradition (Nordic skiing, skating) with new alpine and freestyle disciplines aimed at younger audiences.[2]\n\n---\n\n### Structural and programmatic evolution\n\nAcross 100 years, several broader trends have reshaped the Winter Olympics:\n\n- **Growth in scale**  \n  The Winter Olympics expanded from **16 events and 16 nations** in 1924 to **over 100 events and more than 90 nations** in the early 21st century.[3] Athlete participation increased from 258 in Chamonix to several thousand in recent Games.[1][3]\n\n- **Geographical diversification**  \n  Initially concentrated in the **Alps and Scandinavia**, hosts gradually spread to North America (Lake Placid, Squaw Valley, Calgary, Salt Lake City, Vancouver), Asia (Sapporo, Nagano, PyeongChang, Beijing), Eastern Europe (Sarajevo, Sochi), and a wider range of European regions.[1][5]\n\n- **Sport program innovation**  \n  - Early core: **Nordic skiing, speed skating, figure skating, ice hockey, bobsleigh, curling**.[1][3]  \n  - Mid‑century additions: **alpine skiing** (1936), **biathlon** (1960), **luge** (1964).[2]  \n  - Late 20th century: **freestyle skiing**, **short track**, **snowboarding**, **skeleton**.[2]  \n  - 21st century: expanding **X‑Games‑style events** (slopestyle, halfpipe, big air, cross), **mixed‑team formats**, and new sports such as **ski mountaineering** for 2026.[2]\n\n- **Gender balance and mixed events**  \n  Women participated in figure skating and some early disciplines but were under‑represented; over time, women’s events expanded across almost all sports, and **mixed‑gender events** (e.g., mixed doubles curling, mixed team aerials) have become a key IOC emphasis.[2][3]\n\n- **Scheduling and commercialization**  \n  The decision to **separate the Winter and Summer Games starting in 1994** transformed the Winter Olympics into a stand‑alone global event with its own media and marketing cycle, generating Olympic‑related revenue every two years rather than every four.[1][3]\n\n- **Politics, environment, and legacy**  \n  The Winter Games have intersected with global politics (Nazi Germany 1936, Cold War rivalries, post‑Soviet and contemporary geopolitics) and increasingly with **environmental issues**, as hosts confront climate change, snow reliability, and sustainability, leading to more reuse of existing venues and regional hosting models (e.g., Milano–Cortina).[1][5]\n\nIf you’d like, I can turn this into a compact timeline listing each Winter Games from 1924 onward with host city, notable firsts, and key sports changes.",
          "role": "assistant",
          "reasoning_steps": null,
          "tool_call_id": null,
          "tool_calls": null
        },
        "finish_reason": "stop"
      }
    ],
    "created": 1779896062,
    "model": "sonar-pro",
    "citations": [
      "https://en.wikipedia.org/wiki/Winter_Olympic_Games",
      "https://utaholympiclegacy.org/2026/01/20/timeline-of-winter-sports-added-to-the-olympic-winter-games-1924-2026/",
      "https://info.mysticstamp.com/first-winter-olympic-games_tdih/",
      "https://oakgroveky.org/a-journey-through-time-the-evolution-of-the-olympic-games/",
      "https://www.tandfonline.com/doi/full/10.1080/09523367.2020.1866474",
      "https://www.demonsunglasses.com/blogs/snow-ski-and-snowboard-blog/history-of-the-winter-olympic-games-origins-and-evolution"
    ],
    "object": "chat.completion",
    "search_results": [
      {
        "title": "Winter Olympic Games - Wikipedia",
        "url": "https://en.wikipedia.org/wiki/Winter_Olympic_Games",
        "date": "2002-01-07",
        "last_updated": "2026-04-27",
        "snippet": "The first Winter Olympic Games, the 1924 Winter Olympics, were held in Chamonix, France. The modern Olympic Games were inspired by the ancient Olympic Games, ...",
        "source": "web"
      },
      {
        "title": "Timeline of Winter Sports Added to the Olympic Winter Games (1924 ...",
        "url": "https://utaholympiclegacy.org/2026/01/20/timeline-of-winter-sports-added-to-the-olympic-winter-games-1924-2026/",
        "date": "2026-01-20",
        "last_updated": "2026-04-08",
        "snippet": "The Olympic Winter Games have evolved dramatically since their debut in 1924, reflecting changes in athletic innovation, technology, ...",
        "source": "web"
      },
      {
        "title": "First Winter Olympic Games | Mystic Stamp Discovery Center",
        "url": "https://info.mysticstamp.com/first-winter-olympic-games_tdih/",
        "date": "2026-01-25",
        "last_updated": "2026-03-24",
        "snippet": "The games lasted from January 25 to February 5, 1924, featuring 258 athletes—247 men and 11 women—representing 16 nations. These nations included the United ...",
        "source": "web"
      },
      {
        "title": "A Journey Through Time: The Evolution of the Olympic Games",
        "url": "https://oakgroveky.org/a-journey-through-time-the-evolution-of-the-olympic-games/",
        "date": "2017-07-06",
        "last_updated": "2026-05-17",
        "snippet": "The inclusion of winter sports led to the Winter Olympics, first held in Chamonix, France, in 1924. Women's events were gradually added, starting with ...",
        "source": "web"
      },
      {
        "title": "Full article: The Winter Olympics: A Century of Games on Ice and Snow",
        "url": "https://www.tandfonline.com/doi/full/10.1080/09523367.2020.1866474",
        "date": "2021-03-23",
        "last_updated": "2026-02-03",
        "snippet": "From 1924 to 2010 the Olympic Winter Games were held 21 times, but only ten countries hosted the event. With two-thirds of those games taking ...",
        "source": "web"
      },
      {
        "title": "History of the Winter Olympic Games: origins and evolution",
        "url": "https://www.demonsunglasses.com/blogs/snow-ski-and-snowboard-blog/history-of-the-winter-olympic-games-origins-and-evolution",
        "date": "2025-11-25",
        "last_updated": "2026-01-23",
        "snippet": "The first Winter Olympic Games were held in 1924 in Chamonix, France, at the foot of Mont Blanc. The event was originally called the International Winter Sports ...",
        "source": "web"
      }
    ],
    "status": null,
    "type": null,
    "usage": {
      "completion_tokens": 2702,
      "cost": {
        "input_tokens_cost": 5e-05,
        "output_tokens_cost": 0.04053,
        "total_cost": 0.04658,
        "citation_tokens_cost": null,
        "reasoning_tokens_cost": null,
        "request_cost": 0.006,
        "search_queries_cost": null
      },
      "prompt_tokens": 17,
      "total_tokens": 2719,
      "citation_tokens": null,
      "num_search_queries": null,
      "reasoning_tokens": null,
      "search_context_size": "low"
    }
  }
  ```
</Accordion>

### Combining Videos with Images

You can request both videos and images in the same response:

```python Python SDK theme={null}
from perplexity import Perplexity

client = Perplexity()

completion = client.chat.completions.create(
    model="sonar-pro",
    return_images=True,
    media_response={
        "overrides": {
            "return_videos": True
        }
    },
    messages=[
        {"role": "user", "content": "Summarize the science goals of NASA's Mars Perseverance rover and the significance of the Jezero crater landing site."}
    ]
)
```

<Accordion title="Response">
  ```json theme={null}
  {
    "id": "b278ecef-fc35-417d-b862-02183d0a3a03",
    "choices": [
      {
        "delta": {
          "content": "",
          "role": "assistant",
          "reasoning_steps": null,
          "tool_call_id": null,
          "tool_calls": null
        },
        "index": 0,
        "message": {
          "content": "NASA’s Perseverance rover has four main science goals: **study past habitability**, **search for signs of ancient microbial life**, **collect and cache rock and soil samples for possible return to Earth**, and **test technologies to support future human missions**.[3][1] Jezero Crater was chosen as the landing site because strong evidence shows it once hosted a long‑lived lake and river delta, making it one of the most promising places on Mars to preserve biosignatures in sedimentary rocks.[3][1][2]\n\n**Science goals of Perseverance**\n\nPerseverance is the Mars 2020 rover in NASA’s Mars Exploration Program, and its mission-level science objectives are:[3][1][2][5]\n\n1. **Studying Mars’ habitability (past environments)**\n   - Reconstruct the **ancient environment** at Jezero Crater by studying its rocks, sediments, and geological context.[1][2]  \n   - Determine whether Jezero once had conditions that were **habitable**, such as long‑lasting liquid water, suitable chemistry, and energy sources.[1][3]  \n   - Examine the **climate history** recorded in rock layers, to understand how Mars’ environment evolved over billions of years.[1][2][5]  \n\n2. **Seeking signs of past microbial life (astrobiology)**\n   - Search for **biosignatures**—textural, chemical, or mineralogical evidence that could indicate past microbial life—in rocks that formed in water and are most likely to preserve such evidence.[1][2][3]  \n   - Focus on rocks with **high biosignature preservation potential**, such as fine‑grained sediments in the ancient lakebed and delta deposits.[1]  \n   - Use observations of habitability and preservation to **target the most promising locations** for detailed investigation.[1][2]  \n\n3. **Collecting and caching samples for Mars Sample Return**\n   - Drill **core samples of Martian rock and regolith** and seal them in tubes, caching a carefully documented set that captures the **geologic diversity** of Jezero Crater.[3][1][2]  \n   - Prepare these samples for possible **return to Earth** by a future mission, where laboratory instruments far more capable than those on a rover can analyze them for detailed geochemistry, mineralogy, and possible biosignatures.[3][1][2][4][6]  \n\n4. **Preparing for future human exploration**\n   - Demonstrate **in‑situ resource utilization (ISRU)**, notably producing oxygen from the Martian atmosphere (e.g., MOXIE technology) as a step toward making propellant and breathable oxygen on Mars.[1][6]  \n   - Characterize **atmospheric dust, weather, and environmental conditions** that will affect human systems and health.[1][6]  \n   - Improve **landing and surface operations technologies**, informing safer and more precise landings for future crewed missions.[1][6]  \n\nThese mission-level objectives implement the broader Mars Exploration Program themes: **life, climate, geology, and preparation for humans**.[5][8]\n\n**Why Jezero Crater is a significant landing site**\n\nJezero Crater is considered one of the most scientifically valuable locations on Mars for addressing these goals.[3][1][2][5][7]\n\n1. **Ancient lake and river delta**\n   - Remote sensing data show that **more than 3.5 billion years ago**, river channels breached Jezero’s rim, **flooded the crater**, and created a **long‑lived lake**.[3]  \n   - The crater hosts one of the **best‑preserved river delta deposits** on Mars—a fan‑shaped accumulation of sediments where a river flowed into the lake.[3][7]  \n   - The presence of both **inflow and outflow channels** indicates the lake was not ephemeral; water likely stood in the crater long enough to allow extensive sediment deposition.[7]  \n\n2. **High potential for biosignature preservation**\n   - On Earth, lake and delta environments with **fine‑grained sediments** are excellent at preserving **microbial fossils and chemical biosignatures**; Jezero offers a Mars analog of this setting.[2][3][7]  \n   - Sediments in a quiet lakebed and delta can trap and bury organic matter, potentially preserving signs of life for billions of years.[2][3]  \n   - Perseverance targets precisely these deposit types because they maximize the chance of finding **fossil biosignatures**, if life ever existed there.[1][2]  \n\n3. **Evidence of water‑related minerals**\n   - Orbital observations reveal that Jezero’s rocks contain **clay minerals and carbonates**, which typically form in the presence of liquid water and can help buffer pH, supporting habitable conditions.[3][1][5]  \n   - Such minerals can **encapsulate and preserve organic molecules** and microstructures, making them prime targets for astrobiology.[1][2]  \n\n4. **Geologic diversity and a long time record**\n   - Jezero combines **ancient crater floor rocks**, sedimentary lake and delta deposits, and materials from the surrounding highlands delivered by rivers.[1][3][5]  \n   - This diversity allows Perseverance to investigate **multiple geologic environments and time periods** within a single traversable region, helping reconstruct the **“on‑again, off‑again” wet history** of Mars.[3]  \n   - Exposed layers act as a **stratigraphic record**, capturing changing environmental and climate conditions as each layer formed.[2][5]  \n\n5. **Strategic value for Mars Sample Return**\n   - Because Jezero’s rocks are both **geologically diverse** and **potentially biosignature‑rich**, samples from this site are expected to be highly valuable for **Mars Sample Return**.[3][1][2]  \n   - The cached samples will likely include lakebed mudstones, deltaic sandstones, altered crater floor rocks, and possibly wind‑blown materials and atmosphere samples, together providing a comprehensive record of the site’s history.[3][1]  \n\nIn summary, Perseverance’s science goals are tightly coupled to the unique attributes of Jezero Crater: a once‑wet, mineral‑rich, geologically diverse site that offers one of the best natural laboratories on Mars to determine whether the planet was ever inhabited, how its environment evolved, and how future human explorers might live there.",
          "role": "assistant",
          "reasoning_steps": null,
          "tool_call_id": null,
          "tool_calls": null
        },
        "finish_reason": "stop"
      }
    ],
    "created": 1779896061,
    "model": "sonar-pro",
    "citations": [
      "https://science.nasa.gov/mission/mars-2020-perseverance/science-objectives/",
      "https://www.dlr.de/en/research-and-transfer/projects-and-missions/mars2020/scientific-goals-of-the-mars-2020-mission",
      "https://science.nasa.gov/mission/mars-2020-perseverance/",
      "https://www.energy.gov/ne/articles/powering-perseverance-nasas-mars-2020-mission-fueled-doe-national-labs",
      "https://marspedia.org/Mars_Perseverance_Rover",
      "https://inl.gov/mars-2020/",
      "https://www.youtube.com/watch?v=5qqsMjy8Rx0",
      "https://science.nasa.gov/planetary-science/programs/mars-exploration/science-goals/"
    ],
    "object": "chat.completion",
    "search_results": [
      {
        "title": "Perseverance Science Objectives",
        "url": "https://science.nasa.gov/mission/mars-2020-perseverance/science-objectives/",
        "date": "2024-04-16",
        "last_updated": "2026-04-01",
        "snippet": "In addition to these science goals, Perseverance has a unique goal of collecting and caching samples of Mars material for possible future return. This image of ...",
        "source": "web"
      },
      {
        "title": "Scientific goals of the Mars 2020 mission",
        "url": "https://www.dlr.de/en/research-and-transfer/projects-and-missions/mars2020/scientific-goals-of-the-mars-2020-mission",
        "date": "2021-02-15",
        "last_updated": "2026-01-06",
        "snippet": "One of the two main goals of NASA's Mars 2020 mission is to search for traces of microbial life (biosignatures) on Earth's neighbouring planet.",
        "source": "web"
      },
      {
        "title": "Mars 2020: Perseverance Rover - NASA Science",
        "url": "https://science.nasa.gov/mission/mars-2020-perseverance/",
        "date": "2021-02-18",
        "last_updated": "2026-05-19",
        "snippet": "The rover's mission has four science objectives: Studying Mars' Habitability, Seeking Signs of Past Microbial Life, Collecting and Caching ...",
        "source": "web"
      },
      {
        "title": "Powering Perseverance: NASA's Mars 2020 Mission Fueled by DOE ...",
        "url": "https://www.energy.gov/ne/articles/powering-perseverance-nasas-mars-2020-mission-fueled-doe-national-labs",
        "date": "2026-05-22",
        "last_updated": "2026-05-17",
        "snippet": "The mission of the Mars 2020 Perseverance Rover is to find signs of ancient life and drill and collect soil samples that can be potentially ...",
        "source": "web"
      },
      {
        "title": "Mars Perseverance Rover - Marspedia",
        "url": "https://marspedia.org/Mars_Perseverance_Rover",
        "date": "2026-01-12",
        "last_updated": "2025-10-26",
        "snippet": "The first goal is to determine whether life ever arose on Mars, the second goal is to characterize the climate of Mars, third is to characterize ...",
        "source": "web"
      },
      {
        "title": "Mars 2020 | Powering NASA's Mars Perseverance Rover",
        "url": "https://inl.gov/mars-2020/",
        "date": "2025-07-08",
        "last_updated": "2025-11-23",
        "snippet": "Its mission is simple: To find signs of life and collect rock and soil samples for potential return to Earth in a future mission. The MMRTG will power ...",
        "source": "web"
      },
      {
        "title": "Mission Overview: NASA's Perseverance Mars Rover - YouTube",
        "url": "https://www.youtube.com/watch?v=5qqsMjy8Rx0",
        "date": "2020-07-27",
        "last_updated": "2026-02-17",
        "snippet": "NASA's Mars 2020 Perseverance Rover is heading to the Red Planet to search for signs of ancient life, collect samples for future return to ...",
        "source": "web"
      },
      {
        "title": "Mars Exploration: Science Goals",
        "url": "https://science.nasa.gov/planetary-science/programs/mars-exploration/science-goals/",
        "date": "2024-11-18",
        "last_updated": "2026-05-02",
        "snippet": "NASA's Mars Perseverance rover seeks signs of ancient life and collects samples of rock and regolith for possible Earth return. Mars Science ...",
        "source": "web"
      }
    ],
    "status": null,
    "type": null,
    "usage": {
      "completion_tokens": 1370,
      "cost": {
        "input_tokens_cost": 8e-05,
        "output_tokens_cost": 0.02055,
        "total_cost": 0.02663,
        "citation_tokens_cost": null,
        "reasoning_tokens_cost": null,
        "request_cost": 0.006,
        "search_queries_cost": null
      },
      "prompt_tokens": 28,
      "total_tokens": 1398,
      "citation_tokens": null,
      "num_search_queries": null,
      "reasoning_tokens": null,
      "search_context_size": "low"
    }
  }
  ```
</Accordion>

### Key Parameters

* **`media_response.overrides.return_videos`**: Set to `true` to enable video returns
* **Response format**: Videos appear in the `videos` array with `url`, `thumbnail_url`, and metadata
* **Performance**: Video-enabled requests may take longer to process and produce larger responses

## Best Practices

<Tip>
  **Image optimization**: Compress images before encoding to reduce payload size and token costs. Resize very large images before sending.

  **File preparation**: Ensure documents are text-based (not scanned images). For URLs, verify they return the file directly, not a preview page.

  **Filter strategy**: Start with broad filters and gradually refine based on result quality. Keep filter lists concise (≤10 entries) for best performance.
</Tip>

## Next Steps

<Card title="Sonar Quickstart" icon="rocket" href="/docs/sonar/quickstart">
  Get started with the Sonar API and learn the fundamentals
</Card>
