Skip to main content

Overview

ScryCLI requires an API key to communicate with AI model providers. The API key is stored securely in your local configuration file and is used to authenticate requests to the selected provider.
ScryCLI currently uses OpenRouter as its model provider, which supports multiple AI providers through a unified API.

Setting Your API Key

Using the CLI Command

The easiest way to configure your API key is through the interactive CLI:
1

Launch the API key command

While ScryCLI is running, type:
/apikey
2

Select your provider

Choose from the available providers:
  • OpenAI
  • StepFun
  • Qwen
  • ArceeAI
  • Mistral
  • Zai
3

Choose your model

Select the specific model you want to use from the provider’s available models.
The /apikey command currently routes to model selection. The API key must be set manually in the configuration file.

Manual Configuration

You can manually add your API key to the configuration file:
1

Open the config file

nano ~/.scrycli/config.json
2

Add or update the model.modelKey field

{
  "user": {
    "token": "your-auth-token",
    "userId": "your-user-id"
  },
  "model": {
    "modelProvider": "openai",
    "modelName": "openai/gpt-oss-120b:free",
    "modelKey": "sk-or-v1-your-openrouter-api-key-here"
  }
}
3

Save and restart ScryCLI

Your API key will be loaded on the next run.

Obtaining API Keys

OpenRouter API Key

ScryCLI uses OpenRouter to access multiple AI providers:
1

Visit OpenRouter

2

Create an account

Sign up for a free account
3

Generate API key

Navigate to Settings > API Keys and create a new key
4

Copy the key

Your key will start with sk-or-v1-
OpenRouter provides access to many free models with rate limits. Some premium models require credits.

Configuration Structure

The API key is stored in the model object of your configuration:
{
  "model": {
    "modelProvider": "openai",
    "modelName": "openai/gpt-oss-120b:free",
    "modelKey": "your-api-key"
  }
}

Required Fields

FieldDescriptionExample
modelProviderThe AI provider name"openai", "qwen", "mistral"
modelNameFull model identifier"openai/gpt-oss-120b:free"
modelKeyYour API key"sk-or-v1-..."

Validation

ScryCLI validates your API key configuration before allowing model interactions:
// From src/lib/isModelSelected.ts
if (!config?.model?.modelName) return false;
if (!config?.model?.modelKey) return false;
return config.model.modelName !== '' && config.model.modelKey !== '';
Both modelName and modelKey must be present and non-empty.

Security Best Practices

Your API key is stored in plain text in ~/.scrycli/config.json. Protect this file with appropriate permissions.
Set restrictive permissions on your config file:
chmod 600 ~/.scrycli/config.json
This ensures only you can read and write the configuration.

What NOT to Do

  • Don’t commit config.json to version control
  • Don’t share your API key in public forums
  • Don’t use production API keys for testing
  • Don’t store API keys in environment variables that might be logged

Troubleshooting

”Model not selected” Error

If you see this error, check:
  1. API key is set
    cat ~/.scrycli/config.json | grep modelKey
    
  2. Model name is configured
    cat ~/.scrycli/config.json | grep modelName
    
  3. Both fields are non-empty strings

Invalid API Key

If your requests fail with authentication errors:
1

Verify key format

OpenRouter keys start with sk-or-v1-
2

Check for whitespace

Ensure no extra spaces before or after the key
3

Regenerate if needed

Create a new key in your OpenRouter dashboard

Usage in Code

The API key is used when making model calls:
// From src/model/openRouter.ts
const openRouterClient = new OpenRouter({
  apiKey: '', // Currently hardcoded, should use getConfig().model.modelKey
});

const result = openRouterClient.callModel({
  model: `${getConfig().model.modelName}`,
  instructions: systemPrompt,
  input: prompt
});
The current implementation has the API key hardcoded. You may need to update the code to use getConfig().model.modelKey for proper functionality.

Next Steps

Model Configuration

Learn about available models and selection

Configuration Setup

Understand the full configuration system