<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/LanguageModelSession/streamResponse(to:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation Models",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:16FoundationModels20LanguageModelSessionC14streamResponse2to7optionsAC0G6StreamVy_SSGAA6PromptV_AA17GenerationOptionsVtF::OverloadGroup"
  },
  "title" : "streamResponse(to:options:)"
}
-->

# streamResponse(to:options:)

Produces a response stream to a prompt.

```
final func streamResponse(to prompt: Prompt, options: GenerationOptions = GenerationOptions()) -> sending LanguageModelSession.ResponseStream<String>
```

## Parameters

`prompt`

A prompt for the model to respond to.

`options`

Options that control how tokens are sampled from the distribution the model produces.

## Return Value

A response stream that produces aggregated tokens.

## Discussion> Important: If running in the background, use the non-streaming
> ``doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelSession/respond(to:options:)-6a2gb`` method to
> reduce the likelihood of encountering ``doc://com.apple.foundationmodels/documentation/FoundationModels/LanguageModelError/rateLimited(_:)`` errors.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)