Skip to content

Installation

liter-llm ships prebuilt native packages for all major languages. No Rust toolchain required unless building from source.

Install

Requires Python 3.10+

pip install liter-llm

Or with uv:

uv add liter-llm

Requires Node.js 18+

pnpm add @kreuzberg/liter-llm

Or with npm / yarn:

npm install @kreuzberg/liter-llm
# or
yarn add @kreuzberg/liter-llm

Requires Rust 1.75+ (stable)

cargo add liter-llm

Requires Go 1.23+

go get github.com/kreuzberg-dev/liter-llm/packages/go

Requires Java 17+ (Panama FFM)

Maven:

<dependency>
    <groupId>dev.kreuzberg</groupId>
    <artifactId>liter-llm</artifactId>
    <version>0.1.0</version>
</dependency>

Gradle:

implementation("dev.kreuzberg:liter-llm:0.1.0")

Requires Ruby 3.2+

gem install liter_llm

Or add to your Gemfile:

gem "liter_llm"

Requires PHP 8.2+

composer require kreuzberg/liter-llm

Requires .NET 8+

dotnet add package LiterLlm

Requires Elixir 1.14+ / OTP 25+

Add to mix.exs:

defp deps do
  [
    {:liter_llm, "~> 0.1"}
  ]
end

Then run:

mix deps.get
pnpm add @kreuzberg/liter-llm-wasm

Build from source (requires Rust toolchain):

git clone https://github.com/kreuzberg-dev/liter-llm.git
cd liter-llm
cargo build --release -p liter-llm-ffi

The shared library and C header are output to target/release/.

API Key Setup

liter-llm reads API keys from environment variables. Set the key for the provider(s) you plan to use:

export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GOOGLE_API_KEY="..."
export GROQ_API_KEY="gsk_..."
export MISTRAL_API_KEY="..."
export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."

You only need the key for the provider you are calling

If you only use OpenAI models, only OPENAI_API_KEY is required. liter-llm resolves the provider from the model prefix (e.g. openai/gpt-4o) and injects the matching key automatically.

You can also pass the key directly at client construction:

from liter_llm import LlmClient

client = LlmClient(api_key="sk-...")
import { LlmClient } from "@kreuzberg/liter-llm";

const client = new LlmClient({ apiKey: "sk-..." });
use liter_llm::{ClientConfigBuilder, DefaultClient};

let config = ClientConfigBuilder::new("sk-...").build();
let client = DefaultClient::new(config, None)?;

Do not hard-code keys in source files

Use environment variables or a secret manager. API keys passed to LlmClient are wrapped in secrecy::SecretString internally and never logged.

Verify Installation

python -c "from liter_llm import LlmClient; print('ok')"
node -e "import('@kreuzberg/liter-llm').then(m => { new m.LlmClient({ apiKey: 'test' }); console.log('ok') })"
cargo build
go build ./...

Building from Source

If prebuilt binaries are not available for your platform, you can build from source. This requires the Rust toolchain (stable 1.75+):

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/kreuzberg-dev/liter-llm.git
cd liter-llm
task build

Next Steps