Deep Seek Client
Client for unary (non-streaming) interactions with the DeepSeek API.
Use the DeepSeekClient top-level function to create instances. The client exposes chat completion, Responses, Fill-In-the-Middle completion, user balance, model listing and Files endpoints as extension functions declared in the org.oremif.deepseek.api package.
The client is designed to be long-lived — create one instance and reuse it. Calling close is usually unnecessary.
Example:
val client = DeepSeekClient(System.getenv("DEEPSEEK_API_KEY"))
val response = client.chat("Hello!")
println(response.choices.first().message.content)Types
Builder for configuring and creating DeepSeekClient instances.
Functions
Sends a chat request with default parameters and a DSL for building messages.
Sends a single user message to the chat API.
Sends a chat request with default parameters.
Sends a chat request with custom parameters and a DSL for building messages.
Sends a chat request with custom parameters and messages.
Sends a fully customizable chat completion request.
Sends a chat completion request to the DeepSeek API.
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 fully customizable Responses API request.
Sends a single user message to the Responses API with default parameters.
Sends a conversation to the Responses API with default parameters.
Sends a request to the Responses API.
Sends a conversation built by a DSL, with custom parameters.
Sends a single user message to the Responses API with custom parameters.
Sends a conversation to the Responses API with custom parameters.
Streams a Responses API call as semantic server-sent events.
Deletes a stored file.
Generates a completion using the Fill-In-the-Middle capability with default parameters.
Generates a completion using the Fill-In-the-Middle capability with custom parameters.
Creates a fully customizable FIM completion request using a builder pattern.
Sends a Fill-In-the-Middle (FIM) completion request to the DeepSeek API.
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.