Skip to content

Add OpenAI gateway API key header support - #306

Closed
Deniz Dalkılıç (dalkilicdeniz) wants to merge 1 commit into
responsibleai:mainfrom
dalkilicdeniz:feat/openai-api-key-header
Closed

Add OpenAI gateway API key header support#306
Deniz Dalkılıç (dalkilicdeniz) wants to merge 1 commit into
responsibleai:mainfrom
dalkilicdeniz:feat/openai-api-key-header

Conversation

@dalkilicdeniz

Copy link
Copy Markdown
Collaborator

Summary

Add opt-in support for OpenAI-compatible gateways that require OPENAI_API_KEY in a provider-specific HTTP header in addition to standard Bearer authentication.

Motivation / linked issue

Some API-management gateways expose an OpenAI-compatible /v1 surface but require credentials in an api-key or subscription-key header. LiteLLM's openai/* provider sends Bearer authentication by default, so ASSERT pipeline, init, and ACS calls currently receive 401 from those gateways.

Changes

  • Add ASSERT_OPENAI_API_KEY_HEADER to name the compatibility header while reusing OPENAI_API_KEY as its value.
  • Apply the opt-in header consistently to Chat Completions, Responses, assert-ai init, and ACS generation calls.
  • Preserve explicit per-call headers and keep existing behavior unchanged when the variable is unset.
  • Document the setting in .env.example and add focused regression coverage.

Testing

  • python -m pytest -q tests/test_model_client.py tests/test_init_llm.py tests/test_acs_language_model.py (94 passed)
  • Live sanitized smoke test: ASSERT structured JSON generation through an APIM /openai/v1 gateway with openai/gpt-54 succeeded.

Checklist

  • Tests pass locally (pytest and/or viewer checks as applicable).
  • Docs updated if behavior or public API changed.
  • No secrets, credentials, or customer data committed.
  • No breaking change, or a CHANGELOG.md entry is included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant