Kotlin/Native macOS CLI application that sends a prompt to OpenAI POST /v1/responses and prints the result.
- Uses
OPENAI_API_KEYfrom environment variables. - Default mode (no flags): prints only assistant
output_text. - Verbose mode (
-verbose): prints full response JSON. - Uses
kotlinx.serializationfor JSON serialization/deserialization. - Layered structure:
presentation(CLI parsing/output)domain(repository contract + result model)data(repository implementation + HTTP transport + API DTOs)
- macOS
- JDK 17+
./gradlew linkReleaseExecutableNativeSet API key:
export OPENAI_API_KEY="your_api_key"Default mode:
./build/bin/native/releaseExecutable/macos-native-http-cli.kexeDefault mode with custom prompt:
./build/bin/native/releaseExecutable/macos-native-http-cli.kexe "Say hello in 5 words"Verbose mode:
./build/bin/native/releaseExecutable/macos-native-http-cli.kexe -verbose "Say hello in 5 words"