Nicholas Youngblut
05/08/2025, 10:27 PM• Anthropic model names must begin withclaude
◦ Default:.claude-3-5-sonnet-latest
◦ Tested with Sonnet 3.5 and Haiku 3.5. See the Anthropic docs.
• OpenAI model names must being withgpt
◦ Default:.gpt-4o
◦ Tested with GPT-4o and GPT-4o-mini. See the OpenAI docs.Anyone know if there are any issues with newer models (e.g, claude 3.7, gpt-4.1, or o4-mini)?
Phil Ewels
05/08/2025, 10:40 PMPhil Ewels
05/08/2025, 10:40 PMPhil Ewels
05/08/2025, 10:40 PMclaude-3-7-sonnet-latest ?Nicholas Youngblut
05/08/2025, 11:04 PMNicholas Youngblut
05/09/2025, 3:51 PMenv {
MULTIQC_AI_SUMMARY_FULL = 1 // Enable long summaries during report generation
MULTIQC_AI_PROVIDER = "openai" // Select OpenAI as provider
OPENAI_API_KEY = secrets.OPENAI_API_KEY // Access key for OpenAI
}
Could this be a security risk since the key is exposed for all processes in the entire pipeline via the env scope?
The key could appear in logs if environment variables are dumped (e.g., debug mode of nextflow).Nicholas Youngblut
05/09/2025, 4:38 PMprocess MULTIQC_basic{
secret "OPENAI_API_KEY"
secret "ANTHROPIC_API_KEY"
input:
path multiqc_files, stageAs: "?/*"
output:
path "multiqc_output/*", emit: all
script:
"""
exit 1
# set the provider and enable AI summaries if API key is set
if [ -n "${ANTHROPIC_API_KEY}" ]; then
# if ANTHROPIC_API_KEY is set, use Anthropic as provider
MULTIQC_AI_PROVIDER="anthropic"
elif [ -n "${OPENAI_API_KEY}" ]; then
# if OPENAI_API_KEY is set, use OpenAI as provider
MULTIQC_AI_PROVIDER="openai"
fi
# if OPENAI_API_KEY or ANTHROPIC_API_KEY is set, enable long summaries
if [ -n "${OPENAI_API_KEY}" ] || [ -n "${ANTHROPIC_API_KEY}" ]; then
MULTIQC_AI_SUMMARY_FULL=1
fi
multiqc
[...]
}
However, it appears that secrets MUST be set: Required secret is missing: 'ANTHROPIC_API_KEY'
Any suggestions on how to get around this?Nicholas Youngblut
05/09/2025, 4:51 PMprocess MULTIQC_basic{
secret "AI_API_KEY"
input:
path multiqc_files, stageAs: "?/*"
path multiqc_config
path multiqc_summary
output:
path "multiqc_output/*", emit: all
script:
"""
AI_SETTINGS=""
if [[ "${params.ai_model}" =~ ^(o[1-9]-.*|gpt-.*) ]]; then
# if model starts with "o[3-9]-" or "gpt-" then use OpenAI
AI_SETTINGS="--ai-model ${params.ai_model} --ai-summary --ai-provider openai"
export OPENAI_API_KEY="\${AI_API_KEY}"
elif [[ "${params.ai_model}" =~ ^(claude-.*) ]]; then
# if model starts with "claude-" then use Anthropic
AI_SETTINGS="--ai-model ${params.ai_model} --ai-summary --ai-provider anthropic"
export ANTHROPIC_API_KEY="\${AI_API_KEY}"
fi
multiqc \${AI_SETTINGS} [...]Nicholas Youngblut
05/09/2025, 4:55 PMai | Failed to get a response from OpenAI (attempt 1/1). Error: 400 Client Error: Bad Request for url: <https://api.openai.com/v1/chat/completions>. Retrying in 1s...
ai | Failed to get a response from OpenAI. Error: 400 Client Error: Bad Request for url: <https://api.openai.com/v1/chat/completions>
ai | Failed to interpret report with OpenAI: 400 Client Error: Bad Request for url: <https://api.openai.com/v1/chat/completions>
Also, one cannot currently set the reasoning effortNicholas Youngblut
05/10/2025, 12:52 AMCould this be a security risk since the key is exposed for all processes in the entire pipeline via theWhen using:scope?env
env {
MULTIQC_AI_SUMMARY_FULL = 1 // Enable long summaries during report generation
MULTIQC_AI_PROVIDER = "openai" // Select OpenAI as provider
OPENAI_API_KEY = secrets.OPENAI_API_KEY // Access key for OpenAI
}
as stated in the docs, every .command.run will include the unencrypted secret. This is a big security risk.Phil Ewels
05/10/2025, 6:19 AMPhil Ewels
05/10/2025, 6:21 AMNicholas Youngblut
05/12/2025, 3:28 PMBut it's a fairly well established thing to need to pass API keysI though that the point of
nextflow secrets was to avoid the security issues of just using env variables via the env scope. Using env { OPENAI_API_KEY = secrets.OPENAI_API_KEY } just seems to bypass the use of secrets, except for the fact that you are not hardcoding the secret directly into the codebase.Phil Ewels
05/12/2025, 3:37 PMPhil Ewels
05/12/2025, 3:37 PMPhil Ewels
05/12/2025, 3:37 PMNicholas Youngblut
05/12/2025, 3:51 PM.command.run scripts for the run is definitely a problem for our organization. We don't want unauthorized individuals racking up a large OpenAI/Anthropic API bill before we notice.Adam Talbot
05/12/2025, 4:39 PMUsingCorrect, but secrets are only really supported with local executors so this is a clunky workaround sadpandajust seems to bypass the use of secretsenv { OPENAI_API_KEY = secrets.OPENAI_API_KEY }
Adam Talbot
05/12/2025, 4:41 PMexport OPENAI_API_KEY=$(aws secretsmanager get-secret-value --secret-id OpenAiApiKey)Adam Talbot
05/12/2025, 4:45 PMHowever, it appears that secrets MUST be set:This is why we ended up with this solution for SentieonRequired secret is missing: 'ANTHROPIC_API_KEY'
Adam Talbot
05/12/2025, 4:49 PMprocess.secret = ["OPENAI_API_KEY"]Adam Talbot
05/12/2025, 4:51 PMprocess {
withName: MULTIQC {
secret = ["OPENAI_API_KEY"]
}
}
☝️ that will give you the most specific secret solutionPhil Ewels
05/12/2025, 5:09 PMAdam Talbot
05/12/2025, 5:12 PMAdam Talbot
05/12/2025, 5:12 PMAdam Talbot
05/12/2025, 5:12 PMAdam Talbot
05/12/2025, 5:14 PMprocess MY_SUPER_SECRET_KEY {
debug true
output:
stdout
script:
"""
echo \$MY_SECRET
"""
}
workflow {
MY_SUPER_SECRET_KEY()
}
`nextflow.config`:
process {
withName: MY_SUPER_SECRET_KEY {
secret = ["MY_SECRET"]
}
}
console:
N E X T F L O W ~ version 25.04.1
Launching `./main.nf` [shrivelled_joliot] DSL2 - revision: 4599e938a3
executor > local (1)
[ee/1753e5] process > MY_SUPER_SECRET_KEY [100%] 1 of 1 ✔
oh_no_you_revealed_the_secretNicholas Youngblut
05/12/2025, 5:18 PMNicholas Youngblut
05/12/2025, 5:19 PMCorrect, but secrets are only really supported with local executors so this is a clunky workaroundYeah. It's a big limitation of using Nextflow
Adam Talbot
05/12/2025, 5:34 PMThat process MUST have the secret set, correct? So, you'd need to have 2 very similar processes: one that includes the secret and one for if the user does not provide the secretor use the
def solution we use for Sarek. Or don’t apply that configuration above.