> For the complete documentation index, see [llms.txt](https://onairos.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onairos.gitbook.io/docs/human-api-add-the-right-context-memories-to-any-llm.md).

# Human API - Add the right context/memories to any LLM

Human API is a memory-enhanced endpoint that automatically injects yours or Onairos user's context/memories that are relevant **automatically** to any LLM call<br>

### What is Human API? <br>

Human API is a new addition to Oneiros's vision to make the personalised internet a reality.&#x20;

It works with memory enhancement built-in:&#x20;

\- **Compatible Interface**: Use any OpenAI SDK - just change the base URL&#x20;

\- **Memory Injection**: Add `{onairos_memory}` to prompts for instant personalization&#x20;

\- **Zero Infrastructure**: No databases, embeddings, or RAG pipelines to manage&#x20;

\- **Privacy Built-in**: Automatic PII removal and isolated user data&#x20;

### Quick Example

```javascript
// Standard OpenAI call
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [{
    role: 'user',
    content: 'What should I work out today?'
  }]
});
// Returns: Generic workout advice

// Just change these two lines in your existing code:
const onairos_client = new OpenAI({
  apiKey: 'your_app_api_key_here',           // Your developer key for the application
  baseURL: 'https://developer.onairos.uk/v1' // Our endpoint
});

// Human API call with memory
const response = await onairos_client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{
    role: 'user',
    content: 'Based on {onairos_memory}, what should I work out today?'
  }]
});
// Returns: "Since you did legs yesterday and prefer morning cardio..."
```

### Quick Setup

#### 1. Get Your API Keys

Follow these steps to get started:

* Sign up at developer.onairos.uk
* Create an application (choose your type: fitness, dating, productivity, etc.)
* Generate your API key from the dashboard

#### 1.5 Key descriptions:

* Developer API key beginning with 'ona\_'
* User authorized JWT key, **after** the user authorized Onairos data access via the in app overlay

#### 2. Update Your Code

```javascript
import OpenAI from 'openai';

// Just change these two lines in your existing code:
const onairos_client = new OpenAI({
  apiKey: 'your_app_api_key_here',           // Your developer key for the application
  baseURL: 'https://developer.onairos.uk/v1' // Our endpoint
});

// Add user identification from "Sign in with Onairos"
onairos_client.defaultHeaders = {
  'x-jwt-token': onairosUserJWT  // JWT token from user's Onairos authentication
};
```

#### 3. Add Memory to Prompts

```javascript
// Before: Generic responses
'Help me plan my day'

// After: Personalized with memory
'Based on {onairos_memory}, help me plan my day'

// Onairos automatically injects relevant user context
```

### Getting Started

#### 1. Get Your API Key

* Sign up at developer.onairos.uk
* Create an application (choose your type: fitness, dating, productivity, etc.)
* Generate your API key from the dashboard

#### 2. Update Your OpenAI Client

```javascript
import OpenAI from 'openai';

const onairos_client = new OpenAI({
  apiKey: 'ona_your_api_key_here',
  baseURL: 'https://developer.onairos.uk/v1',
  defaultHeaders: {
    'x-jwt-token': onairosUserJWT  // JWT token from user's Onairos authentication
  }
});
```

#### 3. Add Memory to Your Prompts

```javascript
// Add {onairos_memory} anywhere you want personalization
const response = await onairos_client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{
    role: 'user',
    content: 'Based on {onairos_memory}, suggest my workout for today'
  }]
});
```

#### 4. Start Getting Personalized Responses

Your users immediately get responses that know their preferences, history, and context.

### Real Example: Fitness App Integration

```javascript
// FitTracker app wants to personalize workout recommendations
const response = await onairos_client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{
    role: 'user',
    content: 'Based on {onairos_memory}, what should I focus on in my workout today?'
  }]
});
```

**Without memory:** *"Try a full-body workout with cardio and strength training..."*

**With memory:** *"Your progress shows you've been consistent with cardio. Since you did legs yesterday and prefer 30-minute sessions, let's focus on upper body strength training today."*

### Dating App Example

```javascript
// Dating app helping users with conversation starters
const response = await onairos_client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{
    role: 'user',
    content: 'Based on {onairos_memory}, suggest conversation starters for my matches'
  }]
});
```

**Without memory:** *"Try asking about their hobbies, favorite movies, or travel experiences."*

**With memory:** *"Based on your interest in jazz music and weekend hiking, try asking about their favorite concert or outdoor adventures."*

```
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://onairos.gitbook.io/docs/human-api-add-the-right-context-memories-to-any-llm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
