Files
herolib/examples/ai/openai/openai_init.vsh
Mahmoud-Emad f6734a3568 chore: Remove openrouter client
- Remove call to openrouter.play from the main play function
- Used the OpenAI client instead
- Updated the examples
- Updated the README
2025-10-29 11:42:44 +03:00

25 lines
688 B
GLSL
Executable File

#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import incubaid.herolib.clients.openai
import incubaid.herolib.core.playcmds
// to set the API key, either set it here, or set the OPENAI_API_KEY environment variable
playcmds.run(
heroscript: '
!!openai.configure name: "default" key: "" url: "https://openrouter.ai/api/v1" model_default: "gpt-oss-120b"
'
)!
// name:'default' is the default, you can change it to whatever you want
mut client := openai.get()!
mut r := client.chat_completion(
model: 'gpt-oss-20b'
message: 'Hello, world!'
temperature: 0.3
max_completion_tokens: 1024
)!
println(r.result)