Skip to content

Instantly share code, notes, and snippets.

@xhawk
Created January 7, 2026 14:26
Show Gist options
  • Select an option

  • Save xhawk/2c6a5fb4447a65094bf92b4cf320b11c to your computer and use it in GitHub Desktop.

Select an option

Save xhawk/2c6a5fb4447a65094bf92b4cf320b11c to your computer and use it in GitHub Desktop.
Add ai command to fish by adding content of this gist to ~/.config/fish/config.fish
function ai
set -l prompt (string join ' ' $argv)
set -l payload (jq -n --arg prompt "$prompt" '{
model: "mistral-tiny",
messages: [ { role: "user", content: $prompt } ],
temperature: 0.5
}')
echo $payload | curl -s https://api.mistral.ai/v1/chat/completions \
-H "Authorization: Bearer $MISTRAL_API_KEY" \
-H "Content-Type: application/json" \
-d @- | jq -r '.choices[0].message.content'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment