Skip to main content

Overview

opendev ships rule-based insights out of the box. For AI-generated optimization suggestions, you need an API key from one of:

Quick setup (browser-assisted)

The fastest path:
This:
  1. Opens the provider’s key page in your browser
  2. Prompts you to paste the key (input is masked)
  3. Validates against the provider’s API
  4. Saves to ~/.opendev/credentials.json (chmod 600)

Programmatic setup (CI / dotfiles)

For automated environments:

Environment variables

If you prefer not to install anything new:
Both keys stay in your shell — they’re checked before the credentials file.

Resolution order (AI keys)

When you run opendev, keys are searched in this order:
  1. Shell exports
  2. .env in the installation directory
  3. ~/.opendev/credentials.json Saved by opendev login or opendev config set-key
  4. None — only rule-based insights available
Earlier sources override later ones. CLI flags take precedence over all.

What AI insights include

When a key is configured, opendev tx shows:
  • AI-generated optimization suggestions — custom recommendations based on the transaction structure
  • Provider in use — CLI logs which one at the start of each run
  • Same shape from both — Groq and Anthropic return the same structured format
Without any key, you still get:
  • Rule-based insights — deterministic anomaly detection, nondeterministic-failure warnings, MEV-like patterns, etc.

Custom endpoints (power users)

Override the AI endpoint entirely:
The CLI POSTs the analysis payload to your URL and uses the response.

Disabling AI

Skip AI entirely (useful for debugging or low-latency runs):

Model override

Use a different model than the provider’s default:

Troubleshooting

Invalid key error

If you get “Invalid API key” or auth errors:
  1. Double-check the key format (should start with gsk_... for Groq, sk-ant-... for Anthropic)
  2. Confirm the key is active in the provider’s dashboard
  3. Clear and re-enter:

No key found

If AI suggestions don’t appear:
If it’s empty:
  1. Run opendev login or opendev config set-key
  2. Or set GROQ_API_KEY / ANTHROPIC_API_KEY in your shell

Provider quota exceeded

Groq’s free tier has usage limits. If you hit them:
  • Switch to Anthropic (requires $5+ top-up)
  • Or wait for the quota to reset
  • Or switch to --disable-ai for rule-based only

Best practices

  1. Use Groq for development — free, fast, no credit card
  2. Save to credentials file — use opendev login or opendev config set-key
  3. Pin in CI — set via environment variables in your CI/CD secrets
  4. Rotate keys regularly — delete old keys from the provider’s dashboard
  5. Use --verbose — to see timing and which provider is active:

Examples

Interactive setup

Automated setup (script / dotfiles)

CI/CD (GitHub Actions example)

Disable AI for specific runs