Skip to main content

LlamaIndex LLMs Integration: Helicone

Installation

To install the required packages, run:

pip install llama-index-llms-helicone
pip install llama-index

Setup

Initialize Helicone

Set your Helicone API key via HELICONE_API_KEY (or pass directly). No provider API keys are needed when using the Helicone AI Gateway.

from llama_index.llms.helicone import Helicone
from llama_index.core.llms import ChatMessage

llm = Helicone(
    api_key="<helicone-api-key>",  # or set HELICONE_API_KEY env var
    model="gpt-4o-mini",  # works across providers via gateway
)

Generate Chat Responses

You can generate a chat response by sending a list of ChatMessage instances:

message = ChatMessage(role="user", content="Tell me a joke")
resp = llm.chat([message])
print(resp)

Streaming Responses

To stream responses, use the stream_chat method:

message = ChatMessage(role="user", content="Tell me a story in 250 words")
resp = llm.stream_chat([message])
for r in resp:
    print(r.delta, end="")

Complete with Prompt

You can also generate completions with a prompt using the complete method:

resp = llm.complete("Tell me a joke")
print(resp)

Streaming Completion

To stream completions, use the stream_complete method:

resp = llm.stream_complete("Tell me a story in 250 words")
for r in resp:
    print(r.delta, end="")

Model Configuration

To use a specific model, you can specify it during initialization. For example, to use Mistral's Mixtral model, you can set it like this:

from llama_index.llms.helicone import Helicone

llm = Helicone(model="gpt-4o-mini")
resp = llm.complete("Write a story about a dragon who can code in Rust")
print(resp)

Notes

  • Default Helicone base URL is https://ai-gateway.helicone.ai/v1. Override with api_base or HELICONE_API_BASE if needed.
  • Only HELICONE_API_KEY is required. The gateway routes to the correct provider based on the model string.

Metadata

Release files for llama-index-llms-helicone 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-helicone 0.3.1
File Size Uploaded Provenance Actions
llama_index_llms_helicone-0.3.1.tar.gz 4.9 kB Without provenance Details for llama_index_llms_helicone-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-helicone 0.3.1
File Interpreter ABI Platform Actions
llama_index_llms_helicone-0.3.1-py3-none-any.whl Python 3 none any Details for llama_index_llms_helicone-0.3.1-py3-none-any.whl

Total release size: 9.8 kB

Release files / llama_index_llms_helicone-0.3.1.tar.gz

Download URL llama_index_llms_helicone-0.3.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fee5e5ca908beb3810c2c2bc1df1380efa47623fc0c6c3ae1438c40aac885792
BLAKE2b-256 checksum
How to use checksums
1db36f740ece944f7b8603e58c28a2fa913ac226bfc0a1dbc152653c6dc2ef3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_llms_helicone-0.3.1-py3-none-any.whl

Download URL llama_index_llms_helicone-0.3.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4043f8dbf701adda201171f6da994d594e2619bff89e0509f859419d32147dbc
BLAKE2b-256 checksum
How to use checksums
4f4bcec6642d73ea8544aa67bfcbe5d855546847eefce8b87a7161f55ef607eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-llms-helicone 0.3.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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