The --generate-prompt option generates a formatted prompt that you can use
to consult Large Language Models (LLMs) about datamodel-code-generator CLI options.
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.
datamodel-codegen --generate-prompt "How do I generate strict Pydantic v2 models?"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
Pipe the generated prompt directly to CLI-based LLM tools:
Claude Code is Anthropic's official CLI tool.
Use -p flag for non-interactive (pipe) mode:
datamodel-codegen --generate-prompt "Best options for API response models?" | claude -pCodex CLI is OpenAI's CLI tool.
Use exec subcommand for non-interactive mode:
datamodel-codegen --generate-prompt "How to handle nullable fields?" | codex execOther 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.
Copy the prompt to clipboard, then paste into your preferred web-based LLM chat:
datamodel-codegen --generate-prompt | pbcopydatamodel-codegen --generate-prompt | xclip -selection clipboarddatamodel-codegen --generate-prompt | wl-copydatamodel-codegen --generate-prompt | Set-Clipboarddatamodel-codegen --generate-prompt | clip.exeGenerate a prompt without a specific question:
datamodel-codegen --generate-promptInclude your specific question in the prompt:
datamodel-codegen --generate-prompt "What options should I use for GraphQL schema?"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?"datamodel-codegen \
--input openapi.yaml \
--output-model-type dataclasses.dataclass \
--generate-prompt "How can I add JSON serialization support?" \
| claude -p- 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