From 92b4f38326f3e93d4dc640323fd04ea16878be1b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 16 Sep 2026 14:03:39 +0000 Subject: [PATCH] docs(readme): show how to configure an API key in the quickstart The quickstart's first line that talks to a model is `openai_compatible(model="deepseek-v4-flash")`, and nothing on the page said where the credentials come from -- a reader had to follow a link to the docs site to find out that the base URL is what picks the provider, or that OPENAI_API_KEY against the default base URL means OpenAI and nothing else. Add a "First, your API key" step ahead of the code block: the two variables `openai_compatible` reads, a base-URL table for DeepSeek, GLM, OpenAI and a local server, the separate ANTHROPIC_API_KEY path for `claude`, what a CLI worker does and does not inherit, and `agentdescent doctor` for checking a machine. Wording follows docs/agents.md so the two cannot say different things. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_018YNtrWn9WFYPgi3sWxEvSZ --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 735fd1a4..78b57676 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,38 @@ One entry point, `evolve()`, and three building blocks that turn a dataset into its arguments. The decisions that are actually yours — your data, how to score it, which model — are the ones you still make. +### First, your API key + +This is the first step that talks to a model, so it is the first that needs a +key. Credentials are read from the **environment at call time** — they never +pass through code, arguments, or a file the repo owns. `openai_compatible` reads +two variables, and the base URL is what picks the provider: + +```bash +export OPENAI_BASE_URL=https://api.deepseek.com # the endpoint's root +export OPENAI_API_KEY=sk-... # your key for *that* endpoint +``` + +| provider | `OPENAI_BASE_URL` | +|---|---| +| DeepSeek | `https://api.deepseek.com` | +| GLM / Zhipu | `https://open.bigmodel.cn/api/paas/v4` | +| OpenAI | `https://api.openai.com/v1` — the default, so it may be omitted | +| local (vLLM, Ollama, LM Studio) | `http://localhost:8000/v1` — the key is unused but must be set | + +**Claude is a different variable:** `pip install anthropic`, then +`export ANTHROPIC_API_KEY=sk-ant-...` (or an `ant auth login` profile) and use +`claude(model="claude-haiku-4-5")` in place of `openai_compatible(...)`. A CLI +worker — `claude_code()`, `codex()`, `dsh()`, `opencode()` — inherits these +variables from your shell, but *not* your logged-in host profile: each worker +gets its own config directory so it cannot read your real plugins and MCP +servers. + +Put the `export` lines in your shell profile to keep them across sessions, and +check what a machine actually has with `agentdescent doctor` — it prints which +CLIs and which keys are present, and the base URL's value, never the key's. The +demo above, every `--dry-run`, and `pytest -q` need none of this. + ```python from agentdescent import SingleSlot, evolve, openai_compatible, reflector, scorer, tasks_from from agentdescent.dataloader import hf_rows