Skip to main content

Fixed: "error OPENAI001: 'OpenAI.Responses.ResponsesClient' is for evaluation purposes only and is subject to change or removal in future updates"

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

I connected a Microsoft Agent Framework agent to a Microsoft Foundry model the keyless way Microsoft documents — the OpenAI client library, the OpenAI v1 endpoint and a Microsoft Entra ID token — and the build failed with four errors, all OPENAI001: for evaluation purposes only and is subject to change or removal in future updates. Nothing was wrong with the code; the compiler wanted my consent.

What I Was Doing​

I was building the weather forecast agent of the Microsoft 365 Agents SDK course: an Agents SDK agent whose answers come from Microsoft Agent Framework 1.28.0 and a gpt-5.6-luna deployment in Microsoft Foundry. To avoid API keys, Program.cs creates an OpenAIClient that signs every request with an Entra ID token, and hands its Responses client to Agent Framework:

Program.cs (the model client)
OpenAIClient client = new(
new BearerTokenPolicy(credential, "https://ai.azure.com/.default"),
new OpenAIClientOptions { Endpoint = new Uri(foundry.Endpoint) });

return client.GetResponsesClient();

The agent class takes that ResponsesClient in its constructor and calls AsAIAgent on it. The project references Microsoft.Agents.AI.OpenAI 1.28.0, which brings the OpenAI client library 2.14.0.

The first time I hit this, I had also added the newest OpenAI package, 2.15.0, myself: a separate mistake with its own story, linked under Troubleshooting below. The output here is from the project as it should be, with only Agent Framework's own 2.14.0, and the four errors are the same.

What I Expected​

dotnet build to succeed: every type and method I used exists in the packages.

What I Got​

Output
Restore complete (1.8s)
WeatherAgent net10.0 failed with 4 error(s) (1.7s)
/Users/you/source/WeatherAgent/WeatherForecastAgent.cs(24,22): error OPENAI001: 'OpenAI.Responses.ResponsesClient' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
/Users/you/source/WeatherAgent/WeatherForecastAgent.cs(30,9): error OPENAI001: 'OpenAI.Responses.ResponsesClient' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
/Users/you/source/WeatherAgent/Program.cs(33,27): error OPENAI001: 'OpenAI.OpenAIClient.OpenAIClient(System.ClientModel.Primitives.AuthenticationPolicy, OpenAI.OpenAIClientOptions)' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
/Users/you/source/WeatherAgent/Program.cs(37,12): error OPENAI001: 'OpenAI.OpenAIClient.GetResponsesClient()' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

Build failed with 4 error(s) in 4.0s

macOS-style terminal window: dotnet build of WeatherAgent fails with 4 errors, each OPENAI001, saying OpenAI.Responses.ResponsesClient, the OpenAIClient constructor that takes an AuthenticationPolicy, and OpenAIClient.GetResponsesClient are for evaluation purposes only and are subject to change or removal in future updates

Three different things were flagged: the ResponsesClient type itself (twice: the field and the constructor parameter), the OpenAIClient constructor that takes an AuthenticationPolicy — the one that makes keyless sign-in possible — and GetResponsesClient().

What I Checked​

The message. Suppress this diagnostic to proceed isn't how a real code error reads: it's asking for a decision, not a correction.

The OpenAI .NET library's documentation. Its README has a section called Experimental APIs: Some client APIs are marked with [Experimental] while their .NET design is still evolving. Using one produces a compiler error that you must explicitly suppress for its diagnostic ID. OPENAI001 is that ID.

Microsoft's .NET documentation on experimental APIs. The Preview APIs page explains the mechanism: When building against an experimental API, the compiler produces an error. … To express consent to using an experimental API, you suppress the specific diagnostic. You can do that via any of the means for suppressing diagnostics, but the recommended way is to add the diagnostic to the project's <NoWarn> property. It also notes that consenting to using one experimental feature doesn't consent to using another, because each has its own ID.

Microsoft's own samples for this setup. The Microsoft Foundry and Azure OpenAI code samples that call the OpenAI v1 endpoint with Entra ID all start with #pragma warning disable OPENAI001, one of them with the comment currently required for token based authentication.

Why It Happens​

The OpenAI .NET library marks APIs whose shape may still change with C#'s [Experimental] attribute. The compiler turns every use of such an API into an error until you acknowledge it. The keyless route to Foundry — a token instead of a key, and the Responses API that Agent Framework recommends — runs straight through three of those experimental APIs, so there's no way to use it without accepting OPENAI001.

The Fix​

Acknowledge the diagnostic in the project file, as Microsoft's documentation recommends. Add a NoWarn line to the PropertyGroup of WeatherAgent.csproj:

WeatherAgent.csproj
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!-- OpenAI marks its Responses client and token sign-in as "for evaluation purposes only" (OPENAI001).
Microsoft's keyless samples for the OpenAI v1 endpoint use them, so allow them here. -->
<NoWarn>$(NoWarn);OPENAI001</NoWarn>
</PropertyGroup>

$(NoWarn) keeps any diagnostics the project already ignores, and ;OPENAI001 adds this one. Leave the comment in: whoever reads the project file next sees what was accepted and why.

If you'd rather allow it in only a few places, wrap those lines in #pragma warning disable OPENAI001 and #pragma warning restore OPENAI001, as Microsoft's samples do. With the client used in several files, as here, the project-level setting is simpler.

After the Fix​

Output
Restore complete (0.2s)
WeatherAgent net10.0 succeeded (0.7s) → bin/Debug/net10.0/WeatherAgent.dll

Build succeeded in 1.2s

macOS-style terminal window: with NoWarn OPENAI001 in the project file, dotnet build reports WeatherAgent net10.0 succeeded and Build succeeded

The agent then answered questions from the Foundry model with no API key anywhere.

Common Mistakes​

MistakeWhat happensDo this instead
Switching to an API key to avoid the errorA long-lived secret you have to store and rotateKeep Entra ID and suppress OPENAI001
Adding a long list of IDs to NoWarn "just in case"Unrelated problems disappear tooSuppress only OPENAI001
Writing <NoWarn>OPENAI001</NoWarn> without $(NoWarn);Diagnostics the SDK already ignores come backKeep $(NoWarn); in front

Troubleshooting​

SymptomLikely causeFix
Still OPENAI001 after adding NoWarnThe line went into a different project, or a PropertyGroup with a conditionPut it in the project that uses the client, in an unconditional PropertyGroup
A different ID, such as MEAI001 or MAAI001Another library's experimental APIRead what it is, then add that ID separately
The build succeeds but the agent fails at runtime with MissingMethodExceptionA newer OpenAI package than Agent Framework supportsFixed: "System.MissingMethodException: Method not found: … ResponsesClient.CreateResponseStreamingAsync"

FAQ​

Is it safe to use an experimental API?​

It works and it's supported by the library, but its shape may change in a future version, which could break your build when you upgrade. That's the trade the diagnostic asks you to accept.

Can I avoid experimental APIs entirely?​

Not on this route: the token-based constructor and the Responses client are both marked. The other routes Microsoft documents for Agent Framework and Foundry use prerelease packages.

Does NoWarn hide other experimental APIs too?​

No. Each experimental API has its own ID, so OPENAI001 covers only the OpenAI library's.

Conclusion​

OPENAI001 isn't a bug in your code. It's the OpenAI .NET library asking you to accept that its Responses client and token sign-in may still change. Add <NoWarn>$(NoWarn);OPENAI001</NoWarn>, with a comment saying why, and the keyless Foundry route builds.

Additional Resources​