This integration method is maintained but no longer actively developed. For the best experience and latest features, use our new AI Gateway with unified API access to 100+ models.
import os
from llama_api_client import LlamaAPIClient
# Load environment variables
helicone_api_key = os.getenv("HELICONE_API_KEY")
llama_api_key = os.getenv("LLAMA_API_KEY")
client = LlamaAPIClient(
api_key=llama_api_key,
base_url="https://llama.helicone.ai/v1",
default_headers={
"Helicone-Auth": f"Bearer {helicone_api_key}"
}
)
completion = client.chat.completions.create(
model="Llama-4-Maverick-17B-128E-Instruct-FP8",
messages=[
{
"role": "user",
"content": "What is the moon made of?",
}
],
)
print(completion.completion_message.content.text)
from openai import OpenAI
from dotenv import load_dotenv
import os
load_dotenv()
helicone_api_key = os.getenv("HELICONE_API_KEY")
llama_api_key = os.getenv("LLAMA_API_KEY")
client = OpenAI(
api_key=llama_api_key,
base_url="https://llama.helicone.ai/v1",
default_headers={
"Helicone-Auth": f"Bearer {helicone_api_key}"
}
)
chat_completion = client.chat.completions.create(
model="Llama-4-Maverick-17B-128E-Instruct-FP8",
messages=[{"role": "user", "content": "Hello, how are you?"}],
max_completion_tokens=1024,
temperature=0.7
)
print(chat_completion)