Create examples in JavaScript and Python for Midjourney API via Legnext#6
Open
Create examples in JavaScript and Python for Midjourney API via Legnext#6
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #1
- Create midjourney-example.js with complete implementation - Add node-fetch dependency to package.json - Update .env.example with Legnext API credentials - Update README with Midjourney example instructions The example demonstrates: - Creating image generation jobs with text prompts - Polling for job completion with status tracking - Retrieving generated image URLs and available actions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create midjourney_example.py with complete implementation - Add requests dependency to requirements.txt - Update .env.example with Legnext API credentials - Update README with Midjourney example instructions The example demonstrates: - Creating image generation jobs with text prompts - Polling for job completion with status tracking - Retrieving generated image URLs and available actions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create workflow for JavaScript Midjourney example - Create workflow for Python Midjourney example - Both workflows are manually triggerable via workflow_dispatch - Support custom prompts as workflow inputs - Use repository secrets for API keys - Upload execution logs as artifacts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This reverts commit dc49fb0.
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
🔄 Auto-restart 1/3Detected uncommitted changes from previous run. Starting new session to review and commit them. Uncommitted files: Auto-restart will stop after changes are committed or after 2 more iterations. Please wait until working session will end and give your feedback. |
Added __pycache__/ and Python bytecode files (*.pyc, *.pyo, *.pyd) to prevent them from being tracked in the repository. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive examples for accessing the unofficial Midjourney API via Legnext in both JavaScript and Python, along with GitHub Actions workflows to run them manually.
Changes Made
JavaScript Example
examples/javascript/midjourney-example.jswith full implementationpackage.jsonwithnode-fetchdependency andmidjourneyscript.env.examplewith Legnext API credentialsPython Example
examples/python/midjourney_example.pywith full implementationrequirements.txtwithrequestsdependency.env.examplewith Legnext API credentialsGitHub Actions Workflows
.github/workflows/run-javascript-midjourney.ymlworkflow_dispatch.github/workflows/run-python-midjourney.ymlworkflow_dispatchAPI Documentation Reference
The implementation is based on the official Legnext API documentation:
https://api.legnext.ai/api/v1/diffusion(POST)/v1/job/{job_id}(GET)x-api-keyheaderHow to Use
JavaScript Example
Python Example
GitHub Actions
Navigate to the Actions tab and run either:
Note: You need to add
LEGNEXT_API_KEYto the repository secrets first.Testing
Closes
Fixes #1
🤖 Generated with Claude Code