shannon icon indicating copy to clipboard operation
shannon copied to clipboard

Using OpenAI API key built with azure

Open Redteamer0101 opened this issue 9 months ago • 10 comments

Hi, I'm trying to setup my azure open ai api key but it's coming as Invalid api key.

This is how I put it in .env

OPENAI_API_KEY=key ROUTER_DEFAULT=azure/gpt-5

can you help me to setup this.

Redteamer0101 avatar Feb 20 '26 11:02 Redteamer0101

We haven't tested with Azure OpenAI, but technically it should work with the following changes

  1. You can try adding this to the Providers in the router-config.json and use the .env you have mentioned
    {
      "name": "azure",
      "api_base_url": "https://your-azure-chat-completion-base-url/v1/chat/completions",
      "api_key": "$OPENAI_API_KEY",
      "models": ["gpt-5.2", "gpt-5-mini"],
      "transformer": {
        "use": [["maxcompletiontokens", { "max_completion_tokens": 16384 }]]
      }
    }
  1. Deploy gpt-5.2 and gpt-5-mini models in Azure OpenAI in order to use them
  2. Let us know if you were able to run Shannon successfully using Azure OpenAI. If so we can add it to the README.md, so that it will be helpful for other users as well

ezl-keygraph avatar Feb 20 '26 11:02 ezl-keygraph

Nope getting same error invalid api key let me do bit of troubleshoot seems like it's not taking my api key

Redteamer0101 avatar Feb 23 '26 06:02 Redteamer0101

Hi, I explored this problem and it a requires a lot of efforts to find the solution. Here are my observations so far:

  1. The codebase doesn't support reasoning models as they use responses api. The code is configured to use chat/completions api, so the latest model that supports it is gpt-4.1.
  2. The current OpenAI implementation won't be able to support the Azure OpenAI architecture, and the code given above doesn't solve the issue.

I am working on a solution, but for some reason the Pre recon agent is not saving the pre_recon_deliverable.md file in the correct, due to which the recon agent is failing. Once I am able to get the agents running successfully, I can open a PR with the implementation.

Aman-Haris-855 avatar Feb 23 '26 15:02 Aman-Haris-855

As we mentioned in our README, the Claude Code router is unsupported and is intended as an off-ramp for community-focused exploration of other models. We've noticed a lot of variance using non-Anthropic outside of our default. We are built on the Anthropic harness and, for now, are optimized only for Anthropic models.

keygraphVarun avatar Feb 24 '26 03:02 keygraphVarun

hello, Has this issue been resolved? Can the Azure Anthropic key be used? Thank you

yyyyyyyyuuuuuuu avatar Mar 03 '26 04:03 yyyyyyyyuuuuuuu

hello, Has this issue been resolved? Can the Azure Anthropic key be used? Thank you

Hi, I did get the tool to work with Azure OpenAI GPT 5.2. But it requires a quite few changes in the codebase, and also when the final output is compared to one generated with the Claude Model, the reports are very inferior. Didn't feel the efforts where worth it.

Aman-Haris-855 avatar Mar 03 '26 05:03 Aman-Haris-855

hello, Has this issue been resolved? Can the Azure Anthropic key be used? Thank you

Hi, I did get the tool to work with Azure OpenAI GPT 5.2. But it requires a quite few changes in the codebase, and also when the final output is compared to one generated with the Claude Model, the reports are very inferior. Didn't feel the efforts where worth it.

Okay, thank you for your reply, brother

yyyyyyyyuuuuuuu avatar Mar 03 '26 10:03 yyyyyyyyuuuuuuu

hello, Has this issue been resolved? Can the Azure Anthropic key be used? Thank you

Hi, I did get the tool to work with Azure OpenAI GPT 5.2. But it requires a quite few changes in the codebase, and also when the final output is compared to one generated with the Claude Model, the reports are very inferior. Didn't feel the efforts where worth it.

Okay, thank you for your reply, brother

Let me know if you need the implementation method. I can list out the steps needed to be followed.

Aman-Haris-855 avatar Mar 03 '26 15:03 Aman-Haris-855

@Aman-Haris-855 yes please share the steps

Redteamer0101 avatar Mar 09 '26 08:03 Redteamer0101

@Aman-Haris-855 yes please share the steps

Please apply the following configuration updates.


1. Update configs/router-config.json

Under the OpenAI providers section, update the following parameters:

api_base_url

https://<your_service_name>.cognitiveservices.azure.com/openai/deployments/gpt-5.2/chat/completions?api-version=2025-01-01-preview

Replace the OpenAI API key entry with

$AZURE_API_KEY

models

["gpt-5.2"]

use

[["maxcompletiontokens", { "max_completion_tokens": 128000 }]]

2. Update docker-compose.yml

Under the environment section, update the following variables:

Replace the OpenAI API key entry with:

- AZURE_API_KEY=${AZURE_API_KEY:-}

Update the router default model:

- ROUTER_DEFAULT=${ROUTER_DEFAULT:-openai,gpt-5.2}

Update the maximum output tokens:

- CLAUDE_CODE_MAX_OUTPUT_TOKENS=${CLAUDE_CODE_MAX_OUTPUT_TOKENS:-128000}

3. Update shannon

Replace:

$OPENAI_API_KEY

with:

$AZURE_API_KEY

4. Update .env

Add or update the following variables:

CLAUDE_CODE_MAX_OUTPUT_TOKENS=128000
AZURE_API_KEY= (your api key)
ROUTER_DEFAULT=openai,gpt-5.2

5. Update Prompt Files (only if required)

Affected files:

prompts/exploit-auth.txt
prompts/exploit-authz.txt
prompts/exploit-injection.txt
prompts/exploit-ssrf.txt
prompts/exploit-xss.txt
prompts/recon.txt
prompts/report-executive.txt
prompts/vuln-auth.txt
prompts/vuln-authz.txt
prompts/vuln-injection.txt
prompts/vuln-ssrf.txt
prompts/vuln-xss.txt

Replace:

pre_recon_deliverable.md

with:

code_analysis_deliverable.md

⚠️ Only apply this change if you encounter the error:

code_analysis_deliverable.md file not found

from the recon agent.

Aman-Haris-855 avatar Mar 11 '26 15:03 Aman-Haris-855