Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.llmtune.io/llms.txt

Use this file to discover all available pages before exploring further.

Framework Integrations

This guide shows how to integrate LLMTune with popular AI frameworks.

LangChain Integration

Installation

pip install langchain langchain-openai

Basic Setup

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://api.llmtune.io/v1",
    api_key="your-llmtune-api-key",
    model="meta-llama/Llama-3.3-70B-Instruct",
)

response = llm.invoke("Hello, world!")
print(response.content)

LlamaIndex Integration

Installation

pip install llama-index

Basic Setup

from llama_index.llms.openai import OpenAI

llm = OpenAI(
    api_key="your-llmtune-api-key",
    api_base="https://api.llmtune.io/v1",
    model="meta-llama/Llama-3.3-70B-Instruct",
)

response = llm.complete("Hello, world!")
print(response.text)

OpenAI SDK Integration

Installation

pip install openai

Basic Setup

from openai import OpenAI

client = OpenAI(
    base_url="https://api.llmtune.io/v1",
    api_key="your-llmtune-api-key",
)

response = client.chat.completions.create(
    model="meta-llama/Llama-3.3-70B-Instruct",
    messages=[{"role": "user", "content": "Hello, world!"}],
)

print(response.choices[0].message.content)

Streaming

stream = client.chat.completions.create(
    model="meta-llama/Llama-3.3-70B-Instruct",
    messages=[{"role": "user", "content": "Tell me a story."}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)