mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-20 09:47:53 +00:00
docs(ai): add PowerShell instructions to the minimal chat example (#108567)
* docs(ai): add PowerShell instructions to the minimal chat example Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> * docs(ai): simplify PowerShell key cleanup --------- Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
co-authored by
chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
Peter Steinberger
parent
552fd224cf
commit
b3c0aaf38b
@@ -6,13 +6,31 @@ completion. No OpenClaw application code is involved — inside this repo the
|
||||
workspace link resolves to the package's built `dist`, the same artifact npm
|
||||
consumers install, so `pnpm build` must have run first.
|
||||
|
||||
Choose a provider and replace its placeholder with a real API key.
|
||||
|
||||
POSIX shell commands (the Ollama command also works in PowerShell):
|
||||
|
||||
```sh
|
||||
ANTHROPIC_API_KEY=sk-ant-... node index.mjs "Say hello"
|
||||
OPENAI_API_KEY=sk-... node index.mjs --provider openai "Say hello"
|
||||
ANTHROPIC_API_KEY=example-anthropic-key-not-real node index.mjs "Say hello"
|
||||
OPENAI_API_KEY=example-openai-key-not-real node index.mjs --provider openai "Say hello"
|
||||
# keyless, against a local Ollama server (OLLAMA_MODEL overrides the model id)
|
||||
node index.mjs --provider ollama "Say hello"
|
||||
```
|
||||
|
||||
PowerShell (assignments remain in this session until removed or the shell closes):
|
||||
|
||||
```powershell
|
||||
$env:ANTHROPIC_API_KEY = "example-anthropic-key-not-real"
|
||||
node index.mjs "Say hello"
|
||||
|
||||
$env:OPENAI_API_KEY = "example-openai-key-not-real"
|
||||
node index.mjs --provider openai "Say hello"
|
||||
|
||||
# Clear the session-scoped keys.
|
||||
$env:ANTHROPIC_API_KEY = $null
|
||||
$env:OPENAI_API_KEY = $null
|
||||
```
|
||||
|
||||
Text deltas stream to stdout; stop reason and token usage go to stderr.
|
||||
|
||||
Notes for library consumers:
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Minimal @openclaw/ai consumer: one isolated runtime, built-in providers,
|
||||
// one streamed completion. Uses only the public package surface — no OpenClaw
|
||||
// application code. Run with:
|
||||
// ANTHROPIC_API_KEY=... node index.mjs "your prompt"
|
||||
// OPENAI_API_KEY=... node index.mjs --provider openai "your prompt"
|
||||
// application code. See README.md for build prerequisites and run commands.
|
||||
import { createLlmRuntime } from "@openclaw/ai";
|
||||
import { registerBuiltInApiProviders } from "@openclaw/ai/providers";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user