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.11.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.11.0
File Size Uploaded
genkit_django-0.11.0.tar.gz 11.8 kB Details

Built distribution (wheel)

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

Total release size: 22.7 kB

Release files / genkit_django-0.11.0.tar.gz

Download URL genkit_django-0.11.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0ca682676a4e1e2f3759b176491e20ead4a3f046fec6523b760a84705dc966cb
BLAKE2b-256 checksum
How to use checksums
7d2c5db8b7f01746c6835f36b1485c3f08a5ee1b2c7bc0df0fcee8027a5fe528
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 3, 2026.

Transparency log

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

Download URL genkit_django-0.11.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
743808d9cb881268e9ad815544f6e5c935192ec77152860f7fdc783826a47362
BLAKE2b-256 checksum
How to use checksums
7fccd737ad5c2d44c98ca2dee2f3ee7a612ccb209d936df7cc100dd009f429b1
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 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.12.0

2 release files

This release

0.11.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