Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions ask
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ get_model() {
k) echo "moonshotai/kimi-k2:nitro" ;;
q) echo "qwen/qwen3-235b-a22b-2507:nitro" ;;
o) echo "openai/gpt-5:nitro" ;;
a) echo "GLM-4.5-air" ;;
z) echo "GLM-4.6" ;;
esac
}

Expand Down Expand Up @@ -62,6 +64,8 @@ Options:
-k Use moonshotai/kimi-k2
-q Use qwen/qwen3-235b-a22b-2507 (default)
-o Use openai/gpt-5
-a Use GLM-4.5-air
-z Use GLM-4.6
-m MODEL Use custom model
-r Disable system prompt (raw model behavior)
--stream Enable streaming output
Expand All @@ -84,7 +88,7 @@ EOF
while [ $# -gt 0 ]; do
case "$1" in
-h|--help) show_help ;;
-[cgskqxo])
-[cgskqxoaz])
MODEL="$(get_model "${1:1}")"
shift ;;
-m)
Expand Down Expand Up @@ -145,7 +149,12 @@ JSON_PAYLOAD='{
"stream": '$([ "$STREAMING" = true ] && echo true || echo false)"$PROVIDER_JSON"'
}'

API_URL="https://openrouter.ai/api/v1/chat/completions"
# Use Z.AI if configured, otherwise OpenRouter
if [ -n "${ZAI_BASE_URL:-}" ]; then
API_URL="${ZAI_BASE_URL%/}/chat/completions"
else
API_URL="https://openrouter.ai/api/v1/chat/completions"
fi

# Add newline before answer
echo
Expand Down