Codex CLI: read your AI citations from the shell, key kept out of config
Export a workspace API key as ATTENSIRA_API_KEY, then run codex mcp add attensira --url https://mcp.attensira.com/mcp --bearer-token-env-var ATTENSIRA_API_KEY. Codex reads the key at runtime and sends it itself, so it never enters config.toml. Codex can then read your citations per engine and day, the prompts you lose and the crew's waiting work.
7 days free · card requiredHow the trial works
Asked: How often have answers cited attensira.com in the last four weeks, per engine?
called citation_timeline domain_or_url=attensira.com days=28
1,442 citations, and nearly all of them since 24 September. The number of tracked prompts citing us rose the same day, so read the answers before reading anything into it.
- ChatGPT, 6 to 23 September
- 0 to 8 a day
- 1 or 2 prompts citing us
- ChatGPT, 24 September to 3 October
- 81 to 157 a day
- 3 to 6 prompts citing us
- Perplexity, from 24 September
- 11 to 30 a day
- none before
- Total, 28 days
- 1,442
- ChatGPT 1,235 · Perplexity 207
A timeline is what changed, not why.
Who does the work
Researcher · Read the sources
How do I connect Codex CLI?
export ATTENSIRA_API_KEY="atn_live_…" # in your shell profile
codex mcp add attensira --url https://mcp.attensira.com/mcp \
--bearer-token-env-var ATTENSIRA_API_KEY
What are the limits from the shell?
- Codex connects with a static key, not OAuth. A key never expires until revoked, so revoke it under Settings → Your assistant when the job it was minted for ends.
- A citation timeline does not say why a line moved. More prompts tracked, a provider change or a page change can all make the same step.
- A read-only key cannot write. A write tool returns 403 insufficient_scope, and a key's scope cannot be widened; mint a read-and-write key and swap it in.
- Step 01
Mint a key and export it
Mint a workspace API key under Settings → Your assistant, read-only if Codex only reads. It is shown once, because only a hash is stored. Export it as ATTENSIRA_API_KEY in your shell profile.
- Step 02
Add the server with the env-var flag
Run codex mcp add with the server URL and --bearer-token-env-var naming the variable. Codex reads the token at runtime and sends the Authorization header itself, so the key never enters ~/.codex/config.toml.
- Step 03
Set the variable where Codex launches
The variable has to exist in the shell profile Codex starts from. A key exported only in the terminal you tested in is missing when Codex starts another way, which shows up as an authentication failure.
- Step 04
Fall back to a literal only if you must
If your Codex build has no --bearer-token-env-var, write the key into config.toml under an http_headers table. Treat that file as a secret, keep it out of every repository, and restart Codex after editing.
What do the engines read for an API question?
For “AI search visibility API”, the answers lean on SE Ranking's pages and a run of small vendor sites, and none of 24 cites us. Codex can read the same board and draft the page that is missing.
| Name | Cited in | Count |
|---|---|---|
| seranking.com | 87.5% | 21 |
| keyword.com | 75.0% | 18 |
| github.com | 54.2% | 13 |
| agenticfabriq.com | 50.0% | 12 |
| cituna.com | 50.0% | 12 |
| attensira.comyou | 0.0% | 0 |
What can Codex read from the shell?
- Read citations per engine and per day for your domain or one page, with the mean position, from the shell or a script.
- Check, in a CI step after a deploy, whether the pages you changed are being cited, then measure properly at the +7, +14 and +30 day re-reads.
- Read the prompts you lose and who wins them, and what the crew has waiting for approval.
- Run unattended. The key does not expire until you revoke it, which suits a scheduled or CI job.
What did Codex show on our own workspace?
Almost all of the window's citations came after 24 September, and on the same day the number of our tracked prompts that cited us rose too. That points first at what we were tracking, not at anything we shipped, and the answers are where to confirm it. A timeline tells you a line moved. It never tells you why.
What does a short answer to a tool question name?
Perplexity's answer to “LLM SEO tool” on 3 Oct names no tool at all and links ten listicles. Codex can pull answers like this one by prompt and day, so a script can watch which roundups the engines lean on.
Question: LLM SEO tool
Perplexity answered: LLM SEO tools help brands gain visibility in AI-generated answers by tracking citations and optimizing content for AI surfaces. Popular options cover citation tracking across models like ChatGPT, Perplexity, Gemini, and Google AI, plus content/schema optimization and analytics.
Sources cited
- 1lovedby.ai
- 2seo.co
- 3aiclicks.io
- 4merchynt.com
- 5, 8llmrefs.com
- 6docdigitalsem.com
- +3 more
Not namedAttensira is missing from this Perplexity answer.
Researcher · Stored the answerattensira.com stored Perplexity answer, read over the Attensira MCP · · 10 linksWhat should a deploy check report?
Coverage, not a verdict. Right after a deploy, read whether the changed pages are being fetched and cited at all. The verdict comes from Attensira's own re-reads of each shipped change at +7, +14 and +30 days, each comparing a week before the change with a week around the re-read, and a change inside the noise is reported as no change. A script that reports movement every day is reporting sampling. Name each key after the job it serves, so revoking one breaks nothing else.
Questions about Codex CLI
Does the key end up in ~/.codex/config.toml?
Codex says authentication failed but the key is right. Why?
Can Codex sign in with OAuth instead?
Should the key be read-only?
I lost the key. Can Attensira show it again?
Where do these facts come from?
Attensira's connect documentation states that Codex reads the token from a named environment variable at runtime and sends it as the Authorization header itself, so the key never enters config.toml.
docs.attensira.com · retrieved
“Codex reads the token from a named environment variable at runtime and sends it as the
Authorizationheader itself, so the key never enters~/.codex/config.toml”Attensira's connect documentation states that a key is shown exactly once because only a hash is stored, and that Attensira cannot re-display it.
docs.attensira.com · retrieved
“It is shown exactly once: only a hash is stored, so Attensira cannot re-display it.”
Attensira's MCP overview states that a static API key never expires until it is revoked.
docs.attensira.com · retrieved
“Never, until you revoke it”
Script a citation check into the shell you deploy from.
7 days free · card requiredHow the trial works
Tell it where you want to be cited.
7 days free · card requiredHow the trial works
attensira.com's own workspace · read 4 Oct 2026 · n=4,518
197/ 4,518 answers4.4%