Skip to content

Azure OpenAI Encrypted Reasoning Traces Stripped #10917

@snoozy

Description

@snoozy

Description

Using Azure OpenAI with reasoning is causing traces to be stripped due to providerOptions being under "azure" instead of "openai".

Error sample:

AI SDK Warning (azure.responses / gpt-5.1-codex-max): Non-OpenAI reasoning parts are not supported. Skipping reasoning part: {"type":"reasoning","text":"**Calculating sequentially**\n\nI need to use the functions calculator in a specific order. First, I’m going to add 12 and 7 together. Once I have that result, I’ll multiply it by 3. Afterward, I’ll take that new result and multiply it by 10. Finally, I’ll make sure to report the final result clearly. It’s just a straightforward series of calculations, but I want to make sure I keep everything in the right order!","providerOptions":{"azure":{"itemId":"rs_018ba55c2aba73920169338e24bff081958d9b694f8bfab31a","reasoningEncryptedContent":"gAAAAABpM44nzRNIpoCCKzU8en43vAKuHE1_6heWLF66G4gLXjgOOq4-dtI-FedDBdaqgE51UKkT_jubazuYoMVDI6ou7UzDQeJh6OEd-7YWu90eGA4gdvltOYX52rBNKYxDsqyHXYGJYrUuymbdxHieCHvoO8qUUsBBsKZdwAxgmpwK0KSqOOKy8sby4HATqa3InD5TxGwp3lLF3o0j4_RphfAt2c5ZLOD5K2OTxFQV9qIQuPoV8Ac1VTEPd3NYPOZ2FzJ2XTLO14idKkZ6L1WDQ6DoVsFhPst5eo0EeBUr8DvY7kkjM1zH1whvHqR7cNX_KVpvLEjt9fX4iGPFQTxaEVuIj8lJv1wye7BZBC_l0SOgIqLLKbueBh4IvX0A0zhrukGjZT1DI-KND7T-TNwbWTnxc8swVxNKsBOoKAdGulMtLb7NJ0GDbOnh7CZpQQnNnj8ui5yOat9uir5VctBtOKg5IDydLr_IZnAkO7F-k6ReWlvstC5uVeW5hvSQt97-p4JQaVUuTOHE4L0RR9sCB1msLJ7pUa-LjaYRNSLuAAH3pH6XKGCn5I02SrUv_ajuBdsbJi7gwYlUFl8e8VPtwOXgywNqNd855cFw5RqmiJY4to1EFdl6wg5vlxAHHNamaTcI3fVLFxCtzDcBlUGVF2QPx4JqzRFPw5fDtETL7GnGHXYH7URXn9C7zbmDGZ1MxsB6J_tv6p8oKDaQEFRZLO3HYPQvxgSfKgNpz6kEfZnKY13Q1z_9gMYhCH5vmRftktUQgUiXmBvyeSMOn9A1CI5Z6Qdg3_GjexSDF0V5aDc8R7L37Jg_90pGqpep6YNty4MSCbcQ5qsi0hgGvdLWPyRslK6fbDO8vTwyRTyInHdlnsfSmJ6G8B6igdQHSXhMOkvtqK1sve3-fMIl0MD4ZH8dnSa0xf3CADXitpgVcWamOap203rYzKwwdjxEjaRq53M_GqHTGbhb8jgDGYp6P0z2eGy2hDV1Nqr7KUm8otRrvc2axvs="}}}.

Repro:

 const azureAiReasoning = createAzure({
    resourceName: "<>",
    apiKey: <>,
  });

    const res = await generateText({
    model: azureAiReasoning.responses("gpt-5.1-codex-max"),
    temperature: 1,
    tools: {
      calculator: tool({
        description:
          "A minimal calculator for basic arithmetic. Call it once per step.",
        inputSchema: z.object({
          a: z.number().describe("First operand."),
          b: z.number().describe("Second operand."),
          op: z
            .enum(["add", "subtract", "multiply", "divide"])
            .default("add")
            .describe("Arithmetic operation to perform."),
        }),
        execute: async ({ a, b, op }) => {
          switch (op) {
            case "add":
              return { result: a + b };
            case "subtract":
              return { result: a - b };
            case "multiply":
              return { result: a * b };
            case "divide":
              if (b === 0) {
                return "Cannot divide by zero.";
              }
              return { result: a / b };
          }
        },
      }),
    },
    stopWhen: stepCountIs(20),
    providerOptions: {
      openai: {
        reasoningEffort: "high",
        maxCompletionTokens: 32_000,
        store: false,
        include: ["reasoning.encrypted_content"],
        reasoningSummary: "auto",
      },
    },
    messages: [
      {
        role: "user",
        content:
          "Use the calculator tool to add 12 and 7, then multiply that sum by 3 then multiply by 10. Call the tool separately for each arithmetic step and only 1 tool call per step and report the final result.",
      },
    ],
  });

AI SDK Version

  • "@ai-sdk/provider": "^3.0.0-beta.24"
  • "@ai-sdk/azure": "^3.0.0-beta.86"
  • "ai": "^6.0.0-beta.134"
  • "@ai-sdk/openai": "^3.0.0-beta.84"

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelprovider/azureIssues related to the @ai-sdk/azure providersupport

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions