Skip to content

Azure OpenAI embedding provider fails — api-version not forwarded as URL query parameter #111386

Description

@OliPlus

Bug: Azure OpenAI embedding provider fails — api-version not forwarded as URL query parameter

Describe the bug
When using a custom provider with api: "openai-completions" pointed at an Azure OpenAI deployment for embeddings, the api-version header is sent as an HTTP header but Azure OpenAI requires it as a URL query parameter. The embedding request fails with HTTP 404.

The chat completions path handles this correctly via the OpenAI SDK (buildOpenAICompletionsClientConfig in openai-transport-stream), which detects Azure hosts and moves api-version from headers into URL query params. But the remote embedding provider (createRemoteEmbeddingProvider in memory-core-host-engine-embeddings) does raw HTTP fetches without this logic.

To Reproduce

  1. Configure a custom provider for Azure OpenAI embeddings:
{
  models: {
    providers: {
      "azure-embedding": {
        api: "openai-completions",
        baseUrl: "https://YOUR-RESOURCE.openai.azure.com/openai/deployments/text-embedding-3-small",
        apiKey: "${AZURE_OPENAI_API_KEY}",
        authHeader: false,
        headers: {
          "api-key": "${AZURE_OPENAI_API_KEY}",
          "api-version": "2023-05-15"
        },
        models: [{
          id: "text-embedding-3-small",
          input: ["text"],
          contextWindow: 8191,
          cost: { input: 0.02, output: 0 }
        }]
      }
    }
  },
  agents: {
    defaults: {
      memorySearch: {
        provider: "azure-embedding",
        model: "text-embedding-3-small"
      }
    }
  }
}
  1. Run memory index: openclaw memory index --force --agent main
  2. Error: openai-compatible embeddings failed: HTTP 404: {"error":{"code":"404","message": "Resource not found"}}

Expected behavior
The embedding request should succeed. Azure OpenAI expects api-version as a URL query parameter (e.g., .../embeddings?api-version=2023-05-15), but the remote embedding provider sends it only as an HTTP header, which Azure ignores.

Actual behavior
HTTP 404 from Azure because api-version is missing from the URL query string.

Environment (please complete the following information):

  • OS: macOS 15.7
  • OpenClaw version: 2026.7.1-2
  • Node version: 26.5.0

Additional context
The openai-completions adapter for chat completions handles this correctly — see buildOpenAICompletionsClientConfig in dist/openai-transport-stream-B0WkSqXp.js which detects .openai.azure.com hosts and moves api-version from headers into defaultQuery. The same logic needs to be applied in createRemoteEmbeddingProvider in dist/memory-core-host-engine-embeddings-DVluEqwT.js.

Azure OpenAI SDK provides the AzureOpenAI class (from the openai npm package) which handles this transparently. The embedding provider could use it instead of raw HTTP fetches, or copy the host-detection + query-param injection pattern.

Workaround
Use Gemini embeddings instead (provider: "gemini", model: "gemini-embedding-001"), which work out of the box.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions