public interface ChatApi
| Modifier and Type | Method and Description |
|---|---|
io.reactivex.rxjava3.core.Single<ModelData> |
createChatCompletion(ChatCompletionCreateParams request)
Create a synchronous chat completion with immediate response Waits for the GLM-4
model to complete execution and returns the final result Supports complex
reasoning, tool calling, function execution, and multi-modal understanding Features
advanced capabilities like web search integration, code interpretation, and image
analysis
|
io.reactivex.rxjava3.core.Single<ModelData> |
createChatCompletion(ChatCompletionCreateParams request,
Map<String,String> headers)
Create a synchronous chat completion with custom headers support Waits for the
GLM-4 model to complete execution and returns the final result with custom HTTP
headers Supports complex reasoning, tool calling, function execution, and
multi-modal understanding Features advanced capabilities like web search
integration, code interpretation, and image analysis
|
io.reactivex.rxjava3.core.Single<ModelData> |
createChatCompletionAsync(ChatCompletionCreateParams request)
Create an asynchronous chat completion for long-running tasks Submits the request
and returns immediately with a task ID for later result retrieval Ideal for complex
reasoning tasks, long document processing, or batch operations Supports advanced
GLM-4 models with extended context and computational requirements
|
retrofit2.Call<okhttp3.ResponseBody> |
createChatCompletionStream(ChatCompletionCreateParams request)
Create a streaming chat completion with real-time response Returns response content
incrementally through Server-Sent Events (SSE) for immediate user feedback
Optimized for interactive applications requiring low latency and progressive
content delivery Supports all GLM-4 models with configurable streaming parameters
and token-by-token generation
|
retrofit2.Call<okhttp3.ResponseBody> |
createChatCompletionStream(ChatCompletionCreateParams request,
Map<String,String> headers)
Create a streaming chat completion with custom headers support Returns response
content incrementally through Server-Sent Events (SSE) for immediate user feedback
Optimized for interactive applications requiring low latency and progressive
content delivery Supports all GLM-4 models with configurable streaming parameters
and custom HTTP headers
|
io.reactivex.rxjava3.core.Single<ModelData> |
queryAsyncResult(String id)
Query the result of an asynchronous chat completion task Retrieves the completion
result or current status using the task ID from async request Provides detailed
progress information for long-running tasks and complex reasoning operations
Supports polling-based result retrieval with comprehensive status reporting
|
@Streaming
@POST(value="chat/completions")
retrofit2.Call<okhttp3.ResponseBody> createChatCompletionStream(@Body
ChatCompletionCreateParams request)
request - Chat completion parameters including model selection (glm-4-plus,
glm-4-air, glm-4-flash), messages, temperature, top_p, max_tokens, and streaming
settings@Streaming
@POST(value="chat/completions")
retrofit2.Call<okhttp3.ResponseBody> createChatCompletionStream(@Body
ChatCompletionCreateParams request,
@HeaderMap
Map<String,String> headers)
request - Chat completion parameters including model selection, messages, and
streaming settingsheaders - Custom HTTP headers to be added to the request@POST(value="async/chat/completions") io.reactivex.rxjava3.core.Single<ModelData> createChatCompletionAsync(@Body ChatCompletionCreateParams request)
request - Chat completion parameters including model selection, messages,
advanced reasoning settings, tools configuration, and processing options@POST(value="chat/completions") io.reactivex.rxjava3.core.Single<ModelData> createChatCompletion(@Body ChatCompletionCreateParams request)
request - Chat completion parameters including model selection, conversation
messages, generation settings (temperature, top_p, max_tokens), tools
configuration, and response format@POST(value="chat/completions") io.reactivex.rxjava3.core.Single<ModelData> createChatCompletion(@Body ChatCompletionCreateParams request, @HeaderMap Map<String,String> headers)
request - Chat completion parameters including model selection, conversation
messages, generation settings, tools configuration, and response formatheaders - Custom HTTP headers to be added to the request@GET(value="async-result/{id}")
io.reactivex.rxjava3.core.Single<ModelData> queryAsyncResult(@Path(value="id")
String id)
id - Unique task ID returned from asynchronous chat completion requestCopyright © 2025. All rights reserved.