Skip to main content

KoboldAI API

KoboldAI is a โ€œa browser-based front-end for AI-assisted writing with multiple local & remote AI modelsโ€ฆโ€. It has a public and local API that is able to be used in langchain.

This example goes over how to use LangChain with that API.

Documentation can be found in the browser adding /api to the end of your endpoint (i.e

from langchain_community.llms import KoboldApiLLM

Replace the endpoint seen below with the one shown in the output after starting the webui with โ€“api or โ€“public-api

Optionally, you can pass in parameters like temperature or max_length

llm = KoboldApiLLM(endpoint="", max_length=80)
response = llm("### Instruction:\nWhat is the first book of the bible?\n### Response:")