Skip to main content

Genkit Django Plugin

genkit-django exposes Genkit flows as HTTP endpoints in a Django application. It mirrors genkit-flask and genkit-fastapi: one decorator turns a @ai.flow() into a Django view that speaks the Genkit HTTP protocol (JSON envelope, optional SSE streaming, structured error responses).

Install

uv add genkit-django

Usage

# myapp/views.py
from genkit import Genkit
from genkit_django import genkit_django_handler

ai = Genkit(plugins=[...])


@genkit_django_handler(ai)
@ai.flow()
async def chat(prompt: str) -> str:
    response = await ai.generate(prompt=prompt)
    return response.text
# myproject/urls.py
from django.urls import path
from myapp.views import chat

urlpatterns = [
    path('chat/', chat),
]

The view requires Django's ASGI server (Django 4.1+):

uvicorn myproject.asgi:application

Wire protocol

  • Body: {"data": <flow_input>}. Missing data → 400.
  • Streaming: Accept: text/event-stream or ?stream=true. Each chunk emits data: {"message": ...}\n\n; completion emits data: {"result": ...}\n\n; on exception error: {"error": ...}.
  • Non-stream: {"result": <flow_output>} on success; 500 with HttpErrorWireFormat JSON on exception.

Context provider

async def auth(request_data):
    return {'username': request_data.headers.get('authorization')}


@genkit_django_handler(ai, context_provider=auth)
@ai.flow()
async def chat(prompt, ctx):
    user = ctx.context.get('username')
    ...

Release files for genkit-django 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genkit-django 0.12.0
File Size Uploaded
genkit_django-0.12.0.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for genkit-django 0.12.0
File Interpreter ABI Platform
genkit_django-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.7 kB

Release files / genkit_django-0.12.0.tar.gz

Download URL genkit_django-0.12.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0500c9cbbb1bf96983ea25198b5439c0294071478b0087b8bab8baa138dac596
BLAKE2b-256 checksum
How to use checksums
5e25fd231ac48e6e1f4c4b67f43ce37569c670d78c5165a39f478c0a10c80d49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / genkit_django-0.12.0-py3-none-any.whl

Download URL genkit_django-0.12.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51a97e8f6f08130bb811a01ca5368fd3c392b9a8c32e00baae7b72245b12f217
BLAKE2b-256 checksum
How to use checksums
160d8e1533e3ca796f8a65c8978260c22ba92ced93bfa6c29684aac0fb4c1bd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.12.0 This release

2 release files

0.10.0

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page