For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Contact usJoin the Discord
ManualAPI GuideAPI Reference
  • Overview
    • API Reference
    • Client libraries
  • API Reference
LogoLogo
Contact usJoin the Discord
On this page
  • Anthropic SDK
  • LangChain
Overview

Client libraries

Was this page helpful?
Previous

Messages

Next
Built with

PrivateGPT follows the Claude API model, so any client that speaks that protocol works against it — point it at your local PrivateGPT URL instead of Anthropic’s servers.


Anthropic SDK

Python
TypeScript
$pip install anthropic
1import anthropic
2
3client = anthropic.Anthropic(
4 base_url="http://localhost:8080",
5 api_key="any", # required by the client but not validated by default
6)
7
8message = client.messages.create(
9 model="qwen3.5:35b",
10 max_tokens=1024,
11 messages=[{"role": "user", "content": "Hello!"}],
12)
13print(message.content[0].text)

LangChain

Python
$pip install langchain-anthropic
1from langchain_anthropic import ChatAnthropic
2
3llm = ChatAnthropic(
4 model="qwen3.5:35b",
5 anthropic_api_url="http://localhost:8080",
6 anthropic_api_key="any",
7)
8
9response = llm.invoke("Hello!")
10print(response.content)