This repository was archived by the owner on Jan 24, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/kotlin/io/github/stream29/proxy
relocate/com.aallam.openai.api/chat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,14 +22,15 @@ data class OpenAiConfig(
2222 val baseUrl : String ,
2323 val apiKey : String ,
2424 val modelList : List <String >,
25+ val extraRequest : (ChatCompletionRequest ) -> ChatCompletionRequest = { it },
2526) : ApiProvider {
2627 override suspend fun getModelNameList (): List <String > = modelList
2728 override suspend fun generateLStream (request : LChatCompletionRequest ): Flow <LChatCompletionResponseChunk > {
28- return chatCompletionsRecording(request.asOpenAiRequest()).map { it.asLChatCompletionResponseChunk() }
29+ return chatCompletionsRecording(extraRequest( request.asOpenAiRequest() )).map { it.asLChatCompletionResponseChunk() }
2930 }
3031
3132 override suspend fun generateOStream (request : OChatRequest ): Flow <OChatResponseChunk > {
32- return chatCompletionsRecording(request.asOpenAiRequest()).map { it.asOChatResponseChunk() }
33+ return chatCompletionsRecording(extraRequest( request.asOpenAiRequest() )).map { it.asOChatResponseChunk() }
3334 }
3435
3536 override fun close () {}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import io.github.stream29.proxy.relocate.com.aallam.openai.api.BetaOpenAI
66import io.github.stream29.proxy.relocate.com.aallam.openai.api.model.ModelId
77import kotlinx.serialization.SerialName
88import kotlinx.serialization.Serializable
9+ import kotlinx.serialization.json.JsonElement
910
1011/* *
1112 * Creates a completion for the chat message.
@@ -183,6 +184,9 @@ data class ChatCompletionRequest(
183184 * Options for streaming response. Only used when in streaming mode.
184185 */
185186 @SerialName(" stream_options" ) val streamOptions : StreamOptions ? = null ,
186- val stream : Boolean = true
187+ val stream : Boolean = true ,
188+
189+ @SerialName(" extra_body" )
190+ val extraBody : JsonElement ? = null ,
187191)
188192
You can’t perform that action at this time.
0 commit comments