Deep Seek Client Stream
Client for streaming interactions with the DeepSeek API.
Use the DeepSeekClientStream top-level function to create instances. The client layers the Ktor SSE plugin on top of the default HTTP client configuration and exposes streaming chat and FIM endpoints as extension functions that return a kotlinx.coroutines.flow.Flow of response chunks.
Example:
val client = DeepSeekClientStream(System.getenv("DEEPSEEK_API_KEY"))
client.chat("Write a haiku").collect { chunk ->
print(chunk.choices.firstOrNull()?.delta?.content ?: "")
}Types
Builder for configuring and creating DeepSeekClientStream instances.
Functions
Streams chat responses using default parameters and a message builder DSL.
Streams chat responses for a single user message.
Streams chat responses using default parameters.
Streams chat responses using custom parameters and a message builder DSL.
Streams chat responses using custom parameters and messages.
Sends a chat completion request to the DeepSeek API.
Streams a fully customizable chat completion request.
Streams chat completion responses chunk by chunk from the DeepSeek API.
Closes the underlying HTTP client and suspends until its coroutine scope completes.
Sends a request to the Responses API.
Streams a fully customizable Responses API request.
Streams a single user message through the Responses API with default parameters.
Streams a conversation through the Responses API with default parameters.
Streams a conversation built by a DSL, with custom parameters.
Streams a single user message through the Responses API with custom parameters.
Streams a conversation through the Responses API with custom parameters.
Streams a Responses API call as semantic server-sent events.
Deletes a stored file.
Streams FIM completions with default parameters.
Streams FIM completions using custom parameters and a prompt.
Sends a Fill-In-the-Middle (FIM) completion request to the DeepSeek API.
Streams a fully customizable FIM completion using a builder pattern.
Streams Fill-In-the-Middle (FIM) completions chunk by chunk from the DeepSeek API.
Lists stored files, oldest first, one page at a time.
Retrieves the list of DeepSeek models available for the current API key.
Fetches the metadata of a single stored file.
Uploads an image for a vision model to read, and returns the stored FileObject.
Retrieves the current user's available API balance.