LLM Integration¶
The --generate-prompt option generates a formatted prompt that you can use
to consult Large Language Models (LLMs) about datamodel-code-generator CLI options.
Overview¶
When you're unsure which CLI options to use for your specific use case, you can generate a prompt containing all available options and their descriptions, then ask an LLM for recommendations.
The generated prompt includes:
- Your question (if provided)
- Current CLI options you've specified
- All options organized by category with descriptions
- Full help text for reference
CLI LLM Tools¶
Pipe the generated prompt directly to CLI-based LLM tools:
Claude Code¶
Claude Code is Anthropic's official CLI tool.
Use -p flag for non-interactive (pipe) mode:
OpenAI Codex CLI¶
Codex CLI is OpenAI's CLI tool.
Use exec subcommand for non-interactive mode:
Other CLI Tools¶
Other popular LLM CLI tools that accept stdin:
| Tool | Command | Repository |
|---|---|---|
| llm | \| llm |
simonw/llm |
| aichat | \| aichat |
sigoden/aichat |
| sgpt | \| sgpt |
TheR1D/shell_gpt |
| mods | \| mods |
charmbracelet/mods |
Check each tool's documentation for specific usage and options.
Web LLM Chat Services¶
Copy the prompt to clipboard, then paste into your preferred web-based LLM chat:
macOS¶
Linux (X11)¶
Linux (Wayland)¶
Windows (PowerShell)¶
WSL2¶
Usage Examples¶
Basic Usage¶
Generate a prompt without a specific question:
With a Question¶
Include your specific question in the prompt:
With Current Options¶
Show your current configuration and ask for improvements:
datamodel-codegen \
--input schema.json \
--output-model-type pydantic_v2.BaseModel \
--use-annotated \
--generate-prompt "Are there any other options I should consider?"
Pipe to Claude with Options¶
datamodel-codegen \
--input openapi.yaml \
--output-model-type dataclasses.dataclass \
--generate-prompt "How can I add JSON serialization support?" \
| claude -p
Tips¶
- Be specific - Include a clear question to get more relevant recommendations
- Show context - Add your current options so the LLM understands your setup
- Iterate - Use the suggestions, then ask follow-up questions if needed