---
# AUTO-GENERATED API DOCUMENTATION - DO NOT EDIT
title: mirascope.core.xai.stream
description: API documentation for mirascope.core.xai.stream
---

# mirascope.core.xai.stream

The `XAIStream` class for convenience around streaming xAI LLM calls.

<Info title="Usage">

[Streams](/docs/v1/learn/streams)

</Info>

## <ApiType type="Class" path="core/xai/stream" symbolName="XAIStream" /> XAIStream

A simple wrapper around `OpenAIStream`.

Everything is the same except updates to the `construct_call_response` method and
the `cost` property so that cost is properly calculated using xAI's cost
calculation method. This ensures cost calculation works for non-OpenAI models.

**Bases:** 
<TypeLink type={{"type_str": "OpenAIStream", "description": null, "kind": "simple", "doc_url": "/docs/v1/api/core/openai/stream#openaistream"}} />

<AttributesTable
  attributes={[
  {
    "name": "cost",
    "type_info": {
      "type_str": "float | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "float",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/functions.html#float"
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    },
    "description": "Returns the cost of the call."
  }
]}
/>

## <ApiType type="Function" path="core/xai/stream" symbolName="construct_call_response" /> construct_call_response

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "doc_identifier": null
    }
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "XAICallResponse",
    "description": null,
    "kind": "simple",
    "doc_url": "/docs/v1/api/core/xai/call_response#xaicallresponse"
  }
}}
/>



