Connecting and SDKs
HotKV ships 12 official client SDKs. Each one covers the standard commands and adds typed helpers for the HotKV-exclusive and AI/enterprise commands. The SDKs are open source under the Apache License 2.0, and their source is on GitHub.
Because HotKV speaks RESP2/RESP3, any Redis-compatible client library also
works against it unchanged, for standard commands; reach for a HotKV SDK
when you also want typed access to HotKV-exclusive commands (TAG.*,
VSIM.*, NEXPIRE, …) and the AI/LLM commands covered in the
AI features guide.
Against a cluster, use an SDK’s cluster client or a cluster-aware Redis library: see Cluster clients for the supported ones and for the SDKs that have a cluster class.
Most SDKs accept either explicit options (host, port, username, password)
or a connection URL: hotkv:// for a plain connection, hotkvs:// for
TLS, and, for drop-in migration, redis:///rediss://. See each SDK’s
own TLS options for certificate and mutual-TLS configuration.
Quick start
Section titled “Quick start”pip install hotkv-clientimport hotkv
client = hotkv.HotKV(host="localhost", port=6379)client.set("greeting", "hello")print(client.get("greeting")) # b"hello"client.close()The package is installed as hotkv-client and imported as hotkv. An asyncio
client is available as hotkv.asyncio.HotKV, mirroring the sync client method
for method.
npm install @hotkv/clientimport { HotKV } from "@hotkv/client";
const client = new HotKV({ url: "hotkv://127.0.0.1:6379" });await client.set("greeting", "hello");console.log(await client.get("greeting"));await client.close();Written in TypeScript with full .d.ts types; ships as both ESM and
CommonJS.
go get github.com/hotkv-ltd/hotkv-go-clientpackage main
import ( "context" "fmt" "time"
hotkv "github.com/hotkv-ltd/hotkv-go-client")
func main() { client, _ := hotkv.NewClient(&hotkv.Options{Addr: "localhost:6379"}) defer client.Close()
ctx := context.Background() client.Set(ctx, "key", "value", 60*time.Second) val, _ := client.Get(ctx, "key").Result() fmt.Println(val)}[dependencies]hotkv-client = "1"# For TLS (hotkvs:// / rediss://), use this line instead:# hotkv-client = { version = "1", features = ["tls"] }# The example below also needs a Tokio runtime:tokio = { version = "1", features = ["macros", "rt-multi-thread"] }use hotkv::Client;
#[tokio::main]async fn main() -> hotkv::Result<()> { let client = Client::connect("hotkv://127.0.0.1:6379").await?; client.set("greeting", "hello").await?; let value: Option<String> = client.get("greeting").await?; println!("{value:?}"); Ok(())}The crate is named hotkv-client on crates.io and imported as hotkv. A blocking
wrapper (hotkv::blocking::BlockingClient) is available for callers outside a
Tokio runtime.
<dependency> <groupId>com.hotkv</groupId> <artifactId>hotkv-client</artifactId> <version>1.0.0</version></dependency>import com.hotkv.HotKV;
try (HotKV client = HotKV.create("hotkv://localhost:6379")) { client.set("greeting", "hello, HotKV"); System.out.println(client.get("greeting"));}Zero runtime dependencies: built only on the JDK. Requires Java 17+.
dotnet add package HotKV.Clientusing HotKV;using HotKV.Commands;
await using var client = await HotKVClient.ConnectAsync("hotkv://localhost:6379");await client.StringSetAsync("greeting", "hello from .NET");Console.WriteLine(await client.StringGetAsync("greeting"));Targets net8.0 and netstandard2.1.
gem "hotkv"require "hotkv"
client = HotKV::Client.new(url: "hotkv://localhost:6379")client.set("greeting", "hello")puts client.get("greeting")client.closeRequires Ruby 3.0 or newer; zero runtime dependencies beyond Ruby’s own standard library.
composer require hotkv/client<?phprequire __DIR__ . '/vendor/autoload.php';
use HotKV\Client;
$client = new Client('hotkv://127.0.0.1:6379');$client->set('greeting', 'hello from HotKV');echo $client->get('greeting');$client->close();Pure PHP, zero runtime dependencies, requires PHP 8.1+.
def deps do [{:hotkv, "~> 1.0"}]end{:ok, conn} = HotKV.start_link(url: "hotkv://127.0.0.1:6379")
{:ok, "OK"} = HotKV.command(conn, ["SET", "greeting", "hello"]){:ok, "hello"} = HotKV.command(conn, ["GET", "greeting"])curl -L https://github.com/hotkv-ltd/hotkv-perl-client/archive/refs/heads/main.tar.gz | tar xzcd hotkv-perl-client-mainperl Makefile.PL && make && make installuse HotKV;
my $kv = HotKV->new(url => 'hotkv://127.0.0.1:6379');$kv->set('greeting', 'hello world');print $kv->get('greeting'), "\n";$kv->close;Zero mandatory runtime dependencies beyond core Perl 5.16+ modules;
IO::Socket::SSL is only required for TLS connections.
curl -L https://github.com/hotkv-ltd/hotkv-c-client/archive/refs/tags/v1.0.0.tar.gz | tar xzcd hotkv-c-client-1.0.0cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DHOTKV_BUILD_TESTS=OFF -DHOTKV_BUILD_EXAMPLES=OFFcmake --build buildcmake --install build --prefix /usr/local#include <hotkv.h>
int main(void) { hotkv_context_t *ctx = hotkv_connect("127.0.0.1", 6379); hotkv_reply_t *reply = hotkv_set(ctx, "key", 3, "value", 5); hotkv_free_reply(reply); reply = hotkv_get(ctx, "key", 3); hotkv_free_reply(reply); hotkv_disconnect(ctx); return 0;}The library is built from source, as shown. Then compile with cc -o myapp myapp.c -lhotkv, or with
pkg-config --cflags --libs libhotkv. Configure with -DHOTKV_USE_SSL=ON
for TLS support. Requires a C11 compiler.
curl -L https://github.com/hotkv-ltd/hotkv-cpp-client/archive/refs/tags/v1.0.0.tar.gz | tar xzcd hotkv-cpp-client-1.0.0cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DHOTKV_CPP_BUILD_TESTS=OFFcmake --build buildcmake --install build --prefix /usr/localfind_package(hotkv-cpp CONFIG REQUIRED)target_link_libraries(myapp PRIVATE hotkv::hotkv-cpp)#include <hotkv/hotkv.hpp>
int main() { hotkv::Client client = hotkv::Client::connect("hotkv://127.0.0.1:6379"); client.set("greeting", "hello, hotkv"); auto value = client.get("greeting");}Requires C++20. TLS uses OpenSSL and is built in by default when OpenSSL
is found (-DHOTKV_CPP_WITH_TLS=OFF leaves it out).
Framework integrations
Section titled “Framework integrations”The Python and Node.js SDKs ship integrations for the AI frameworks teams
already build with, on top of the same prompt cache (PCACHE) and
semantic cache (SCACHE) covered in the
AI features guide. The Python examples below use a
client created as in the Python tab of the Quick start; the framework
packages themselves (langchain-core, llama-index-core, litellm) come
with the matching extra.
LangChain (Python)
Section titled “LangChain (Python)”pip install "hotkv-client[langchain]"from langchain_core.globals import set_llm_cachefrom hotkv.integrations.langchain import HotKVCache
set_llm_cache(HotKVCache(client, namespace="chat-responses", ttl=3600))Also included: HotKVSemanticCache (caches by embedding similarity),
HotKVVectorStore (a VectorStore backed by VSIM.*), and
HotKVChatMessageHistory.
LlamaIndex (Python)
Section titled “LlamaIndex (Python)”pip install "hotkv-client[llamaindex]"from hotkv.integrations.llama_index import HotKVVectorStore
vector_store = HotKVVectorStore(client, index_name="docs", dims=1536)Also included: HotKVKVStore and HotKVChatStore.
LiteLLM (Python)
Section titled “LiteLLM (Python)”pip install "hotkv-client[litellm]"import litellmfrom hotkv.integrations.litellm import HotKVCache
litellm.cache = litellm.Cache()litellm.cache.cache = HotKVCache(client, namespace="litellm-cache")LiteLLM’s own built-in litellm.Cache(type="redis", ...) also works
against HotKV unchanged for exact-match caching, since HotKV speaks the
Redis wire protocol. Reach for this integration when you also want
semantic caching (HotKVSemanticCache, in the same module), or want
caching to keep working on a plan or license without the prompt cache
feature: HotKVCache falls back to plain GET/SET there.
Vercel AI SDK (Node.js)
Section titled “Vercel AI SDK (Node.js)”Ships in the @hotkv/client npm package as @hotkv/client/ai-sdk. Install the AI SDK
itself (ai, version 5 or newer) and your model provider package
alongside it.
import { wrapLanguageModel, generateText } from "ai";import { openai } from "@ai-sdk/openai";import { HotKV } from "@hotkv/client";import { hotkvCache } from "@hotkv/client/ai-sdk";
const client = new HotKV({ url: "hotkv://127.0.0.1:6379" });const model = wrapLanguageModel({ model: openai("gpt-4o"), middleware: hotkvCache({ client, ttlSeconds: 3600 }),});
const { text } = await generateText({ model, prompt: "Summarize this in one line." });hotkvCache() is language model middleware for wrapLanguageModel(): it
caches both generateText() results and streamText() streams.
LangChain.js (Node.js)
Section titled “LangChain.js (Node.js)”Ships in the @hotkv/client npm package as @hotkv/client/langchain. Install
@langchain/core and your model package alongside it.
import { HotKV } from "@hotkv/client";import { HotKVCache } from "@hotkv/client/langchain";import { ChatOpenAI } from "@langchain/openai";
const client = new HotKV({ url: "hotkv://127.0.0.1:6379" });const model = new ChatOpenAI({ cache: new HotKVCache(client, { namespace: "chat-responses", ttlSeconds: 3600 }),});HotKVSemanticCache(client, embeddings, { threshold }) does the same by
embedding similarity.
Next steps
Section titled “Next steps”- AI features guide
- MCP server, the LangGraph checkpointer and store and the caching gateway for AI assistants and agents
- Command reference
- Security for TLS certificate options
Was this page helpful?
Thanks for the feedback.