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.10.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.10.0
File Size Uploaded
genkit_django-0.10.0.tar.gz 11.7 kB Details

Built distribution (wheel)

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

Total release size: 22.6 kB

Release files / genkit_django-0.10.0.tar.gz

Download URL genkit_django-0.10.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
35a20d79e46573e0387a338f1ebd102afabfaefefdb7c600c55a05bd1dacf05d
BLAKE2b-256 checksum
How to use checksums
afe3ecbc59f4d28c0d2b89af34a71c2880f19611020f9512d8d09305b172066e
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 Aug 20, 2026.

Transparency log

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

Download URL genkit_django-0.10.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c7f20ea771739251559b612b3420d26020e6df6c7a5977dea3d07bad6946784
BLAKE2b-256 checksum
How to use checksums
1d60420c56d16d65d384915a18bb4cce57a1d48fe89143863521153a0c393859
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 Aug 20, 2026.

Transparency log

Release history Release notifications | RSS feed

0.12.0

2 release files

This release

0.10.0 This release

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