Skip to content

feat(skills): Grok Imagine image gen via DroidProxy OAuth - #226

Merged
nikships merged 2 commits into
mainfrom
feat/grok-imagine-skill
Jul 28, 2026
Merged

feat(skills): Grok Imagine image gen via DroidProxy OAuth#226
nikships merged 2 commits into
mainfrom
feat/grok-imagine-skill

Conversation

@nikships

Copy link
Copy Markdown
Owner

Summary

  • Add a Factory skill at .factory/skills/grok-imagine/SKILL.md that generates images through DroidProxy (POST http://localhost:8317/v1/images/generations with grok-imagine-image / grok-imagine-image-quality).
  • Reuses the existing Grok OAuth path in ThinkingProxy — no XAI_API_KEY when Grok is connected in Settings.
  • Document the feature in README.md and SETUP.md so users know chat models alone do not call Imagine; they need this skill (or an equivalent shell/MCP call).

Why

Droid chat does not invoke xAI's image endpoint. Hermes and Grok Build expose first-class image tools; with DroidProxy, the auth tunnel already works for any grok-* model on the image path — this skill is the missing agent-facing surface.

How to use (after merge)

mkdir -p ~/.factory/skills
cp -R .factory/skills/grok-imagine ~/.factory/skills/

Requires DroidProxy running + Grok connected. Then ask Droid to generate an image.

Test plan

  • DroidProxy running, Grok OAuth connected
  • Smoke: curl -sS http://localhost:8317/v1/images/generations with model grok-imagine-image and a short prompt returns URL or b64_json
  • Copy skill to ~/.factory/skills/grok-imagine and ask Droid to generate an image and write a file
  • Confirm README / SETUP copy is clear that chat model selection alone is not enough

Document subscription-based image generation through the local proxy and ship a Factory skill that posts to /v1/images/generations so Droid can save images without an XAI_API_KEY.
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 56366753-8d8b-4af9-b8f5-5a99caedbb1f

📥 Commits

Reviewing files that changed from the base of the PR and between e2627c8 and b11e6a0.

📒 Files selected for processing (3)
  • README.md
  • SETUP.md
  • skills/grok-imagine/SKILL.md

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added documentation for generating images with Grok through the connected OAuth session.
    • Added a Grok Imagine skill with setup instructions, supported parameters, platform-specific examples, and troubleshooting guidance.
    • Documented local request routing, model usage, response formats, and saving generated images.
  • Documentation

    • Clarified that image generation is separate from chat and does not require an API key.
    • Added setup steps for installing and using the image-generation skill.

Walkthrough

Documents a new Grok Imagine skill, its installation and invocation through DroidProxy, cross-platform image-saving procedures, request parameters, troubleshooting guidance, and OAuth-based routing details.

Changes

Grok Imagine integration

Layer / File(s) Summary
Skill scope and installation
skills/grok-imagine/SKILL.md, README.md, SETUP.md
Defines the skill’s prerequisites, endpoint routing, OAuth requirements, parameters, installation steps, and separation from chat usage.
Cross-platform generation procedures
skills/grok-imagine/SKILL.md
Documents macOS/Linux, URL-response, and Windows PowerShell request and image-saving workflows.
Troubleshooting and restrictions
skills/grok-imagine/SKILL.md
Adds troubleshooting cases and rules for authentication, model selection, payload formats, temporary URLs, and failed requests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit hops where images bloom,
Through OAuth paths that clear the gloom.
With prompts in hand and files to save,
Grok paints bright pixels brave.
No secret key beneath my hat—
DroidProxy handles that!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and clearly summarizes the main change: Grok Imagine image generation via DroidProxy OAuth.
Description check ✅ Passed The description is directly related to the changeset and matches the added skill and documentation updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/grok-imagine-skill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.factory/skills/grok-imagine/SKILL.md:
- Around line 94-102: Update the example around the image-generation curl
request to capture the API response, check and surface any .error value, extract
the temporary .data[0].url, and immediately download it with curl -fsSL to a
saved output file instead of only printing the URL.
- Line 88: Update the base64 decoding command in the image output flow to use a
platform-correct decoder on macOS and Linux. Detect the platform with uname and
invoke BSD base64 with -D on macOS while retaining -d for Linux, or use an
equivalent portable decoding approach; preserve writing the decoded data to OUT.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aac782d0-210a-4efe-9cba-572ab51af8b5

📥 Commits

Reviewing files that changed from the base of the PR and between 117c3ae and e2627c8.

📒 Files selected for processing (3)
  • .factory/skills/grok-imagine/SKILL.md
  • README.md
  • SETUP.md

exit 1
fi

echo "$RESP" | jq -r '.data[0].b64_json' | base64 -d > "$OUT"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate SKILL.md =="
fd -a 'SKILL\.md$' . | sed -n '1,50p'

echo
echo "== target excerpt =="
if [ -f .factory/skills/grok-imagine/SKILL.md ]; then
  nl -ba .factory/skills/grok-imagine/SKILL.md | sed -n '70,100p'
fi

echo
echo "== base64 decode flags in target =="
rg -n 'base64|jq -r|b64_json|uname|platform|macOS|Darwin' .factory/skills/grok-imagine/SKILL.md || true

echo
echo "== local base64 flags =="
base64 --version 2>&1 | sed -n '1,5p' || true
printf '\n'
printf 'ABC==' | base64 -d >/tmp/base64_gnu_probe.out && cat /tmp/base64_gnu_probe.out || true
printf '\n'
printf 'ABC==' | base64 -D >/tmp/base64_bsd_probe.out && cat /tmp/base64_bsd_probe.out || true
printf '\n'
stat -c '%s' /tmp/base64_gnu_probe.out /tmp/base64_bsd_probe.out 2>/dev/null || true

Repository: nikships/droidproxy

Length of output: 242


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== git-tracked SKILL.md candidates =="
git ls-files | awk '$0 ~ /(SKILL|README|instruction|prompt).*\.md$/i {print}' | sed -n '1,80p'

echo
echo "== target file exists and excerpt =="
if [ -f .factory/skills/grok-imagine/SKILL.md ]; then
  awk 'NR>=70 && NR<=100 {printf "%6d\t%s\n", NR, $0}' .factory/skills/grok-imagine/SKILL.md
else
  echo "missing .factory/skills/grok-imagine/SKILL.md"
fi

echo
echo "== relevant symbols =="
grep -nE 'base64|jq -r|b64_json|uname|platform|macOS|Darwin|OUT|RESP' .factory/skills/grok-imagine/SKILL.md || true

echo
echo "== local base64 implementation =="
case "$(uname -s)" in
  Linux) printf 'linux\n' ;;
  Darwin) printf 'darwin\n' ;;
  *) printf '%s\n' "$(uname -s)" ;;
esac
command -v base64 || true
base64 --version 2>&1 | sed -n '1,4p' || true
printf 'ABC==' | base64 -d >/tmp/base_probe.out && hexdump -C /tmp/base_probe.out || true
printf 'ABC==' | base64 -D >/tmp/base_probe_D.out && hexdump -C /tmp/base_probe_D.out || true

Repository: nikships/droidproxy

Length of output: 2689


Use a platform-correct base64 decoder.

This section is macOS/Linux and uses base64 -d, which fails under macOS’s BSD base64 that requires -D. Branch on uname or use a portable decoder.

Proposed fix
-echo "$RESP" | jq -r '.data[0].b64_json' | base64 -d > "$OUT"
+if [[ "$(uname -s)" == "Darwin" ]]; then
+  echo "$RESP" | jq -r '.data[0].b64_json' | base64 -D > "$OUT"
+else
+  echo "$RESP" | jq -r '.data[0].b64_json' | base64 -d > "$OUT"
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "$RESP" | jq -r '.data[0].b64_json' | base64 -d > "$OUT"
if [[ "$(uname -s)" == "Darwin" ]]; then
echo "$RESP" | jq -r '.data[0].b64_json' | base64 -D > "$OUT"
else
echo "$RESP" | jq -r '.data[0].b64_json' | base64 -d > "$OUT"
fi
🧰 Tools
🪛 SkillSpector (2.3.11)

[warning] 66: [E1] External Transmission: Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Remediation: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.

(Data Exfiltration (E1))


[warning] 36: [RA2] Session Persistence: Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Remediation: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.

(Rogue Agent (RA2))

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.factory/skills/grok-imagine/SKILL.md at line 88, Update the base64 decoding
command in the image output flow to use a platform-correct decoder on macOS and
Linux. Detect the platform with uname and invoke BSD base64 with -D on macOS
while retaining -d for Linux, or use an equivalent portable decoding approach;
preserve writing the decoded data to OUT.

Comment on lines +94 to +102
```bash
PROMPT='Mountain landscape at sunrise'
curl -sS http://localhost:8317/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer dummy-not-used" \
-d "$(jq -n --arg p "$PROMPT" \
'{model:"grok-imagine-image", prompt:$p, aspect_ratio:"16:9"}')" \
| jq -r '.data[0].url'
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Download the temporary URL instead of only printing it.

This example emits .data[0].url to stdout, while the skill requires URL results to be downloaded promptly and saved. Capture the response, handle .error, then download the URL with curl -fsSL before it expires.

🧰 Tools
🪛 Betterleaks (1.6.1)

[high] 96-98: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🪛 SkillSpector (2.3.11)

[warning] 66: [E1] External Transmission: Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Remediation: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.

(Data Exfiltration (E1))


[warning] 36: [RA2] Session Persistence: Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Remediation: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.

(Rogue Agent (RA2))

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.factory/skills/grok-imagine/SKILL.md around lines 94 - 102, Update the
example around the image-generation curl request to capture the API response,
check and surface any .error value, extract the temporary .data[0].url, and
immediately download it with curl -fsSL to a saved output file instead of only
printing the URL.

Keep the skill at the repo root instead of under .factory/, and update
README/SETUP install paths accordingly.
@nikships
nikships merged commit 02042b9 into main Jul 28, 2026
2 of 3 checks passed
@nikships
nikships deleted the feat/grok-imagine-skill branch July 28, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant