> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://humanloop.com/docs/v4/sdk/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://humanloop.com/_mcp/server.
> Learn how to integrate Humanloop into your applications using our Python and TypeScript SDKs or REST API.
The Humanloop platform can be accessed through the API or through our Python and TypeScript SDKs.
### Usage Examples
**`Installation`**
```shell title="Installation"
pip install humanloop
```
**`Example usage`**
```python title="Example usage"
from humanloop import Humanloop
humanloop = Humanloop(
api_key="YOUR_API_KEY",
openai_api_key="YOUR_OPENAI_API_KEY",
)
chat_response = humanloop.chat(
project="sdk-example",
messages=[
{
"role": "user",
"content": "Explain asynchronous programming.",
}
],
model_config={
"model": "gpt-3.5-turbo",
"max_tokens": -1,
"temperature": 0.7,
"chat_template": [
{
"role": "system",
"content": "You are a helpful assistant who replies in the style of {{persona}}.",
},
],
},
inputs={
"persona": "Jeff Dean",
},
stream=False,
)
print(chat_response)
```
**`Installation`**
```shell title="Installation"
npm i humanloop
```
**`Example usage`**
```typescript title="Example usage"
import { Humanloop } from "humanloop";
const humanloop = new Humanloop({
apiKey: "YOUR_HUMANLOOP_API_KEY",
openaiApiKey: "YOUR_OPENAI_API_KEY",
});
const chatResponse = await humanloop.chat({
project: "sdk-example",
messages: [
{
role: "user",
content: "Write me a song",
},
],
model_config: {
model: "gpt-4",
temperature: 1,
},
});
console.log(chatResponse);
```
> Learn how to integrate Humanloop into your applications using our Python and TypeScript SDKs or REST API.