Warning
DO NOT send proprietary code, credentials, or sensitive data to any LLM unless you are certain your organization’s IT policies permit it.
Local models (Ollama) stay on your machine.
We’ll treat LLMs as black boxes — you send text in, text comes back.
Goal: demystify the API so you can wire one into a Shiny app.
What’s the capital of the moon?
There isn’t one.
Are you sure?
Yes, I am sure.
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4.1",
"messages": [
{"role": "system", "content": "You are a terse assistant."},
{"role": "user", "content": "What is the capital of the moon?"}
]
}'The entire conversation is replayed on every request.
What’s the capital of the moon?
There isn’t one.
Are you sure?
Yes, I am sure.
What’s the capital of the moon?
It’s Long Beach, California.
I don’t think that’s correct.
Yeah you’re right. It’s not Long Beach.
Language warning
It is Michael Reeves, after all…
Tokens are the fundamental unit — roughly ¾ of a word on average.
Try it: https://tiktokenizer.vercel.app/
| Provider | Models | Notes |
|---|---|---|
| OpenAI | GPT-4.1, o3 | OPENAI_API_KEY |
| Anthropic | Claude Sonnet/Opus | ANTHROPIC_API_KEY |
| Gemini 2.5 | GOOGLE_API_KEY |
|
| GitHub Models | Many (free) | GITHUB_TOKEN |
| Ollama | Llama, Qwen, … | Local, free |
Free access to many frontier models using a GitHub PAT.
chatlas is a unified Python interface to all major LLM providers:
Same API regardless of provider — swap one line to switch models.
LLMs can call functions in your code:
The LLM decides when to call the tool and what arguments to pass.
PyCon US 2026. chendaniely/pycon-2026-shiny