# Build an AI Changelog Generator in Python

> Source: <https://dev.to/sonam_50a41a4ced7e6b4f3fa/build-an-ai-changelog-generator-in-python-2le9>
> Published: 2026-07-10 00:27:18+00:00

Writing changelogs is one of those developer tasks that sounds simple until you are staring at a messy commit history.

Some commits matter to users. Some are internal cleanup. Some are merge commits. Some are meaningful only if you already know the codebase. I built a small Python example that turns commit messages or git diffs into structured changelog JSON using Telnyx AI Inference.

Code: [https://github.com/team-telnyx/telnyx-code-examples/tree/main/changelog-generator-python](https://github.com/team-telnyx/telnyx-code-examples/tree/main/changelog-generator-python)

The Flask app exposes:

```
POST /generate
POST /generate/from-diff
GET /changelogs
GET /changelogs/<id>
GET /health
```

`POST /generate`

accepts a list of commit messages:

```
{
  "version": "v1.4.0",
  "repo_name": "billing-service",
  "commits": [
    "feat: add Stripe webhook retry with exponential backoff",
    "fix: correct tax calculation for EU VAT exemption",
    "docs: update API reference for invoice endpoint"
  ]
}
```

The app asks Telnyx AI Inference to return grouped changelog JSON with sections like:

There is also a `POST /generate/from-diff`

endpoint if you want to summarize a git diff instead of commit messages.

For a changelog tool, plain text is useful, but structured output is more flexible.

If the response comes back as JSON, you can:

The example stores generated changelogs in memory and gives each one an ID, so you can list recent changelogs or retrieve a specific one.

Clone the examples repo:

```
git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/changelog-generator-python
```

Create your `.env`

file:

```
cp .env.example .env
```

Add your Telnyx API key:

```
TELNYX_API_KEY=your_telnyx_api_key
AI_MODEL=moonshotai/Kimi-K2.6
HOST=127.0.0.1
```

Install and run:

```
pip install -r requirements.txt
python app.py
```

Try it:

```
curl -X POST http://localhost:5000/generate \
  -H "Content-Type: application/json" \
  -d '{
    "version": "v1.4.0",
    "repo_name": "billing-service",
    "commits": [
      "feat: add Stripe webhook retry with exponential backoff",
      "fix: correct tax calculation for EU VAT exemption",
      "docs: update API reference for invoice endpoint"
    ]
  }' | python3 -m json.tool
```

This is a small example, but it is a pretty practical developer tooling pattern:

The Telnyx code examples repo is also agent-readable, so you can use this example as a starting point and ask a coding agent to add GitHub integration, tag comparison, a UI, or a docs publishing step.
