# environment

All environment variables used by the YESNO terminal.

## Required

These are needed for core functionality.

### OPENROUTER\_API\_KEY

**Used by**: `polymarket-analyze.js`, `agents-run.js`

OpenRouter API key for AI model access. Powers the analysis engine (Claude Haiku, Claude Sonnet, Gemini Flash) and the agent trading system.

Get one at <https://openrouter.ai>.

### BRAVE\_API\_KEY

**Used by**: `polymarket-analyze.js`

Brave Search API key for real-time news retrieval. Each market analysis fetches up to 5 relevant news articles.

Get one at <https://brave.com/search/api>.

## Optional (Agents)

These enable the AI trading agent system. Without them, the Agents panel shows empty state but everything else works.

### UPSTASH\_REDIS\_REST\_URL

**Used by**: `agents-run.js`, `agents-state.js`

Upstash Redis REST API URL. Stores agent portfolios, trade history, and round state.

### UPSTASH\_REDIS\_REST\_TOKEN

**Used by**: `agents-run.js`, `agents-state.js`

Upstash Redis REST API token.

Get both at <https://upstash.com>.

### AGENTS\_CRON\_KEY

**Used by**: `agents-run.js`, `agents-reset.js`

Secret key to authenticate cron requests. Set this to any random string and include it in the cron URL.

## Optional (Fallback)

### GROQ\_API\_KEY

**Used by**: `polymarket-analyze.js`

Groq API key for fallback AI inference. If OpenRouter fails (rate limit, downtime), the analysis engine falls back to Groq.

Get one at <https://console.groq.com>.

## Optional (MCP)

### MCP\_TOKEN

**Used by**: `mcp.js`

Token for authenticating MCP requests. If set, some tools (analysis, signals, news) require this token as a Bearer header. If not set, all tools are open.

## Summary

| Variable                   | Required    | Used By                 |
| -------------------------- | ----------- | ----------------------- |
| `OPENROUTER_API_KEY`       | Yes         | AI analysis, agents     |
| `BRAVE_API_KEY`            | Yes         | News search             |
| `UPSTASH_REDIS_REST_URL`   | Agents only | Agent state persistence |
| `UPSTASH_REDIS_REST_TOKEN` | Agents only | Agent state persistence |
| `AGENTS_CRON_KEY`          | Agents only | Cron authentication     |
| `GROQ_API_KEY`             | No          | AI fallback             |
| `MCP_TOKEN`                | No          | MCP authentication      |

{% hint style="warning" %}
Security Notes

* Never commit API keys to version control
* Use Vercel environment variables for production
* Use `.env.local` for local development (gitignored)
* `MCP_TOKEN` should be a strong random string if exposed publicly
* `AGENTS_CRON_KEY` prevents unauthorized agent execution
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yesno-1.gitbook.io/yesno-docs/self-hosting/environment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
