Minimal LLM Chat Interface
Overview
A minimal-dependency client for Large Language Model chat APIs. Supports 'OpenAI' https://openai.com/, 'Anthropic' 'Claude' https://claude.com/, 'Moonshot' 'Kimi' https://www.moonshot.ai/, 'OpenAI' 'Codex' subscription endpoints, 'Ollama' https://ollama.com/, and other 'OpenAI'-compatible endpoints. Includes an agent loop with tool use and a 'Model Context Protocol' client https://modelcontextprotocol.io/. API design is derived from the 'ellmer' package, reimplemented with only base R, 'curl', 'jsonlite', and 'tinyoauth'.
- New
openai_compatibleprovider: pointchat(),agent(), andchat_session()at any OpenAI-compatible gateway (OpenRouter, DeepSeek, corporate proxies). The base URL comes fromllm_base()orOPENAI_COMPATIBLE_BASE_URL("/chat/completions" is appended, so include any /v1 prefix the gateway expects); the key fromllm_key(),OPENAI_COMPATIBLE_API_KEY, orOPENAI_API_KEY, and a keyless gateway is fine (no Authorization header is sent). Model ids pass through untouched and are required (no default). A missing base URL or model fails fast with instructions instead of a curl error. Requested in cornball-ai/corteza#149. agent()'s OpenAI-wire request now omits theAuthorizationheader when no key is configured (matchingchat()), so keyless gateways don't receive a bare "Bearer " header.
Show all changes in 0.1.9Hide the rest of the changes in 0.1.9
- The endpoint/key options are renamed to
llm.api_baseandllm.api_key, matching the sibling API packages (tts.api_base,stt.api_base,xtx.api_base).llm_base()/llm_key()are unchanged. The pre-0.1.8.1 names (llm.api.api_base/llm.api.api_key) are still read as a fallback, with a one-time deprecation warning per session.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK3 OK2026-04-17
Documentation
- Help pages
- 34
- Examples that run
- 29%8 run in a plain check · 20 never run
- Exported functions with examples
- 82%
- Documented parameters
- 98%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 22
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Issues over time
PRs over time
Commits over time
4 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/cornball-ai/llm.api on 2026-10-21.
This repository shows signs of AI coding tools.
- Claude Codefirst seen on or before 2026-01-04Seen in the repository: CLAUDE.mdNamed in .Rbuildignore: .claude, CLAUDE.mdCommits: at least 20 crediting it in the message
- Claude CodePull requests: 1 from outside contributors, first on 2026-06-26
- Claude Opus 4.520 commits · Jan 2026
Dependencies
Installing llm.api adds 4 packages (3 with compiled code, 2.0 MB of source tarballs). Heaviest: jsonlite 1.0 MB, curl 714 KB, digest 231 KB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.1.9Latest
- 0.1.82026-06-26 · diff ↗
- 0.1.72026-06-26 · diff ↗ ·
added 7 exports
anthropic_claude_credentials, chat_claude_oauth, chat_openai_codex, chat_session_openai_codex, claude_oauth_login, openai_codex_credentials, openai_codex_login - 0.1.4
- 0.1.32026-05-15 · diff ↗ ·
added 4 exports
history_count_tool_calls, history_tool_calls, prices_snapshot_date, provider_default_model - RR 4.6.0 released · 2026-04-24
- 0.1.12026-04-16
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2026-04-16
- Total releases
- 6 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.5.0
- Download size
- 97 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("llm.api")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.