Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions sdk/guides/llm-profiles.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: LLM Profiles
description: Persist LLM configurations on disk and reference them from conversation state.
---

<Note>
This example is available on GitHub: [examples/01_standalone_sdk/35_llm_profiles.py](https://github.com/OpenHands/software-agent-sdk/blob/main/examples/01_standalone_sdk/35_llm_profiles.py)
</Note>

LLM profiles are full LLM configurations stored as JSON files. They are provider-neutral: a profile can include any LLM fields that matter for your provider (e.g., `model`, `base_url`, `temperature`, etc.).

Profiles are stored under:

- `$LLM_PROFILES_DIR/<profile_id>.json` when `LLM_PROFILES_DIR` is set
- `~/.openhands/llm-profiles/<profile_id>.json` otherwise

## Security note

By default, `LLMRegistry.save_profile(..., include_secrets=True)` writes secret fields (like API keys) to disk.

If you want keyless profiles, save profiles with `include_secrets=False` and provide secrets at runtime via env vars.

Check warning on line 21 in sdk/guides/llm-profiles.mdx

View check run for this annotation

Mintlify / Mintlify Validation (allhandsai) - vale-spellcheck

sdk/guides/llm-profiles.mdx#L21

Did you really mean 'keyless'?

## Example

```python icon="python" expandable examples/01_standalone_sdk/35_llm_profiles.py
# code will be auto-synced from agent-sdk
```

```bash Running the Example
export LLM_PROFILE_NAME="gpt-5-mini"
export LLM_MODEL="openhands/gpt-5-mini"
export LLM_API_KEY="your-api-key"
# optionally:
# export LLM_PROFILES_DIR="$PWD/.llm-profiles"

uv run python examples/01_standalone_sdk/35_llm_profiles.py
```