Introduction
This crate exposes an async stream API for the widely-used OpenAI chat completion API.
Supported features:
- Stream generation
- Tool calls
- Reasoning content (Qwen3, Deepseek R1, etc)
This crate is built on top of
reqwestandserde_json.
use ;
use ;
let chat_client = init;
// create and pin the stream
let stream = chat_client
.chat_completion_stream
.await
.unwrap;
pin_mut!;
// buffer for the new message
let mut message = new;
// consume the stream
while let Some = stream.next.await
Notice
Copyright 2025, Mengxiao Lin.
This is a part of nah project. nah means "Not A
Human". Source code is available under MPL-2.0.