Menu ▾ ▴

#22 Add `azure` (Azure OpenAI) provider to `orko-providers` crate

open
nobody
2026-08-22
2026-08-22
Anonymous
No

Originally created by: SAMAD101

Summary

Azure OpenAI support in orko-providers. Same wire format as [#3], but auth and URL construction differ enough that this is a codec variant, not a plain preset.

What differs from the stock OpenAI engine

  • Auth: api-key: <key> header instead of Authorization: Bearer (Entra ID token auth out of scope for v0.1).
  • URL shape: {endpoint}/openai/deployments/{deployment}/chat/completions?api-version={ver} — the deployment name takes the place of the model in the path, and api-version is a required query param.
  • The model field in the request body is ignored by Azure; the deployment is the routing key.

Spec

  • Env keys: AZURE_OPENAI_API_KEY + AZURE_OPENAI_ENDPOINT (e.g. https://my-resource.openai.azure.com); optional AZURE_OPENAI_API_VERSION with a maintained default.
  • from_str example: "azure:my-gpt4o-deployment" — the segment after : is the deployment name.
  • Builder must allow setting endpoint + api-version explicitly (not everyone uses env).

Implementation note

The request/response/SSE codec from [#3] is reused wholesale — only the URL builder and header set are swapped. If [#3]'s preset struct can express "custom header name for the key" + "URL template", this collapses back into a preset; try that first and only fork the code path if it can't.

Acceptance

  • Unit test: URL built from endpoint + deployment + api-version matches the documented shape.
  • Unit test: request carries api-key header, no Authorization.
  • SSE parse reuses [#3]'s tests (no duplication).
  • clippy -D warnings clean.

Depends on [#3].

Related

Tickets: #3

Discussion


Log in to post a comment.