UseNextChatOptions
Defined in: react-nextjs/src/client.ts:20
Extended options for Next.js useChat.
Extends
Section titled “Extends”Properties
Section titled “Properties”
optionalapi:string
Defined in: react-core/dist/types/types.d.ts:117
API endpoint for chat
Inherited from
Section titled “Inherited from”
optionalbody:Record<string,unknown>
Defined in: react-core/dist/types/types.d.ts:121
Request body extras
Inherited from
Section titled “Inherited from”direct?
Section titled “direct?”
optionaldirect:DirectModeOptions
Defined in: react-core/dist/types/types.d.ts:130
Direct backend mode configuration. When provided, bypasses HTTP and uses the backend adapter directly.
Inherited from
Section titled “Inherited from”experimental?
Section titled “experimental?”
optionalexperimental:object
Defined in: react-nextjs/src/client.ts:24
Experimental features
partialHydration?
Section titled “partialHydration?”
optionalpartialHydration:boolean
Enable partial hydration
suspense?
Section titled “suspense?”
optionalsuspense:boolean
Enable React Suspense
generateId()?
Section titled “generateId()?”
optionalgenerateId: () =>string
Defined in: react-core/dist/types/types.d.ts:132
Generate unique message IDs
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”headers?
Section titled “headers?”
optionalheaders:Record<string,string>
Defined in: react-core/dist/types/types.d.ts:119
Request headers
Inherited from
Section titled “Inherited from”
optionalid:string
Defined in: react-core/dist/types/types.d.ts:115
Chat ID for persistence
Inherited from
Section titled “Inherited from”initialInput?
Section titled “initialInput?”
optionalinitialInput:string
Defined in: react-core/dist/types/types.d.ts:113
Initial input value
Inherited from
Section titled “Inherited from”initialMessages?
Section titled “initialMessages?”
optionalinitialMessages:Message[]
Defined in: react-core/dist/types/types.d.ts:111
Initial messages
Inherited from
Section titled “Inherited from”UseChatOptions.initialMessages
keepLastMessageOnError?
Section titled “keepLastMessageOnError?”
optionalkeepLastMessageOnError:boolean
Defined in: react-core/dist/types/types.d.ts:138
Keep last message on error
Inherited from
Section titled “Inherited from”UseChatOptions.keepLastMessageOnError
maxToolRoundtrips?
Section titled “maxToolRoundtrips?”
optionalmaxToolRoundtrips:number
Defined in: react-core/dist/types/types.d.ts:140
Max number of automatic tool retries
Inherited from
Section titled “Inherited from”UseChatOptions.maxToolRoundtrips
onError()?
Section titled “onError()?”
optionalonError: (error) =>void
Defined in: react-core/dist/types/types.d.ts:136
Called on error
Parameters
Section titled “Parameters”Error
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”onFinish()?
Section titled “onFinish()?”
optionalonFinish: (message) =>void
Defined in: react-core/dist/types/types.d.ts:134
Called when response stream finishes
Parameters
Section titled “Parameters”message
Section titled “message”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”onResponse()?
Section titled “onResponse()?”
optionalonResponse: (response) =>void
Defined in: react-core/dist/types/types.d.ts:125
Called for each response chunk (HTTP mode only)
Parameters
Section titled “Parameters”response
Section titled “response”Response
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”sendExtraMessageFields?
Section titled “sendExtraMessageFields?”
optionalsendExtraMessageFields:boolean
Defined in: react-core/dist/types/types.d.ts:142
Send extra message fields
Inherited from
Section titled “Inherited from”UseChatOptions.sendExtraMessageFields
serverAction()?
Section titled “serverAction()?”
optionalserverAction: (body) =>Promise<unknown>
Defined in: react-nextjs/src/client.ts:22
Use server action instead of API route
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Promise<unknown>
streamProtocol?
Section titled “streamProtocol?”
optionalstreamProtocol:"text"|"data"
Defined in: react-core/dist/types/types.d.ts:123
Stream protocol