Skip to content

Instantly share code, notes, and snippets.

@shaoyanji
Last active January 5, 2026 12:56
Show Gist options
  • Select an option

  • Save shaoyanji/1530d9ba7b07dc0938d064f83c942db5 to your computer and use it in GitHub Desktop.

Select an option

Save shaoyanji/1530d9ba7b07dc0938d064f83c942db5 to your computer and use it in GitHub Desktop.
minimalistic unixy way to run Google Gemini AI - dependency: curl, gum, yq
#!/usr/bin/env bash
#age -d -i ~/.ssh/id_ed25519 ~/.env.age | grep GEMINI | awk -F'=' '{print $2}'
export $(age -d -i ~/.ssh/id_ed25519 ~/.env.age)
#!/usr/bin/env bash
curl -sS https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent -H "x-goog-api-key: $GEMINI_API_KEY" -H "Content-Type: application/json" -X POST -d '{"contents":[{"parts":[{"text": "'"$(gum input)"'"}]}]}' | yq .candidates.[].content.parts.[].text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment