mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-19 23:01:32 +00:00
Allow startup without API keys, fixes #288
This commit is contained in:
parent
ce8a1c8eb1
commit
e234e8d18f
4 changed files with 48 additions and 12 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- **Allow startup without API keys**: Interactive mode no longer throws when no API keys are configured. Users can now start the agent and use `/login` to authenticate. ([#288](https://github.com/badlogic/pi-mono/issues/288))
|
||||||
- **`--system-prompt` file path support**: The `--system-prompt` argument now correctly resolves file paths (like `--append-system-prompt` already did). ([#287](https://github.com/badlogic/pi-mono/pull/287) by [@scutifer](https://github.com/scutifer))
|
- **`--system-prompt` file path support**: The `--system-prompt` argument now correctly resolves file paths (like `--append-system-prompt` already did). ([#287](https://github.com/badlogic/pi-mono/pull/287) by [@scutifer](https://github.com/scutifer))
|
||||||
|
|
||||||
## [0.27.2] - 2025-12-23
|
## [0.27.2] - 2025-12-23
|
||||||
|
|
|
||||||
|
|
@ -422,8 +422,7 @@ export class AgentSession {
|
||||||
if (!this.model) {
|
if (!this.model) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"No model selected.\n\n" +
|
"No model selected.\n\n" +
|
||||||
"Set an API key (ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.)\n" +
|
`Use /login, set an API key environment variable or create ${getModelsPath()}\n\n` +
|
||||||
`or create ${getModelsPath()}\n\n` +
|
|
||||||
"Then use /model to select a model.",
|
"Then use /model to select a model.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -517,16 +517,15 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
||||||
if (!model) {
|
if (!model) {
|
||||||
const available = await discoverAvailableModels();
|
const available = await discoverAvailableModels();
|
||||||
time("discoverAvailableModels");
|
time("discoverAvailableModels");
|
||||||
if (available.length === 0) {
|
if (available.length > 0) {
|
||||||
throw new Error(
|
|
||||||
"No models available. Set an API key environment variable " +
|
|
||||||
"(ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.) or provide a model explicitly.",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
model = available[0];
|
model = available[0];
|
||||||
if (modelFallbackMessage) {
|
if (modelFallbackMessage) {
|
||||||
modelFallbackMessage += `. Using ${model.provider}/${model.id}`;
|
modelFallbackMessage += `. Using ${model.provider}/${model.id}`;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// No models available - set message so user knows to /login or configure keys
|
||||||
|
modelFallbackMessage = "No models available. Use /login or set an API key environment variable.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let thinkingLevel = options.thinkingLevel;
|
let thinkingLevel = options.thinkingLevel;
|
||||||
|
|
@ -542,7 +541,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp to model capabilities
|
// Clamp to model capabilities
|
||||||
if (!model.reasoning) {
|
if (!model || !model.reasoning) {
|
||||||
thinkingLevel = "off";
|
thinkingLevel = "off";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
37
unset-env.sh
Executable file
37
unset-env.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Unset all provider API keys
|
||||||
|
|
||||||
|
unset OPENAI_API_KEY
|
||||||
|
unset OPENAI_KEY
|
||||||
|
unset ANTHROPIC_API_KEY
|
||||||
|
unset ANTHROPIC_OAUTH_TOKEN
|
||||||
|
unset GROQ_API_KEY
|
||||||
|
unset OPENROUTER_API_KEY
|
||||||
|
unset GEMINI_API_KEY
|
||||||
|
unset CEREBRAS_API_KEY
|
||||||
|
unset HF_TOKEN
|
||||||
|
unset XAI_API_KEY
|
||||||
|
unset ZAI_API_KEY
|
||||||
|
unset EXA_API_KEY
|
||||||
|
unset MINIMAX_API_KEY
|
||||||
|
unset MISTRAL_API_KEY
|
||||||
|
unset ELEVENLABS_API_KEY
|
||||||
|
unset BRAVE_API_KEY
|
||||||
|
|
||||||
|
echo "Unset the following provider API keys:"
|
||||||
|
echo " OPENAI_API_KEY"
|
||||||
|
echo " OPENAI_KEY"
|
||||||
|
echo " ANTHROPIC_API_KEY"
|
||||||
|
echo " ANTHROPIC_OAUTH_TOKEN"
|
||||||
|
echo " GROQ_API_KEY"
|
||||||
|
echo " OPENROUTER_API_KEY"
|
||||||
|
echo " GEMINI_API_KEY"
|
||||||
|
echo " CEREBRAS_API_KEY"
|
||||||
|
echo " HF_TOKEN"
|
||||||
|
echo " XAI_API_KEY"
|
||||||
|
echo " ZAI_API_KEY"
|
||||||
|
echo " EXA_API_KEY"
|
||||||
|
echo " MINIMAX_API_KEY"
|
||||||
|
echo " MISTRAL_API_KEY"
|
||||||
|
echo " ELEVENLABS_API_KEY"
|
||||||
|
echo " BRAVE_API_KEY"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue