mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-09 01:09:54 +00:00
initial commit
This commit is contained in:
22
openrouter.go
Normal file
22
openrouter.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/revrost/go-openrouter"
|
||||
)
|
||||
|
||||
func OpenRouterClient() *openrouter.Client {
|
||||
return openrouter.NewClient(OpenRouterToken)
|
||||
}
|
||||
|
||||
func OpenRouterStartStream(ctx context.Context, request openrouter.ChatCompletionRequest) (*openrouter.ChatCompletionStream, error) {
|
||||
client := OpenRouterClient()
|
||||
|
||||
stream, err := client.CreateChatCompletionStream(ctx, request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stream, nil
|
||||
}
|
Reference in New Issue
Block a user