Skip to content

Unable to configure Azure OpenAI custom endpoint in Stakpak due to missing API version option; requests fail with "error decoding response body #386

@SURAJTHEGREAT

Description

@SURAJTHEGREAT

Description: When configuring a custom OpenAI-compatible endpoint hosted in Azure with Stakpak, there is no option to specify the required API version. Referencing the documentation https://stakpak.gitbook.io/docs/get-started/configure-stakpak#stakpak-open-source , I attempted to append the version as a query parameter to the endpoint URL, but requests fail. Without a placeholder for API version in the configuration flow, it’s unclear how to correctly set up Azure OpenAI endpoints.

Attempted endpoint: https://rsg-dummy.openai.azure.com?api-version=2024-12-01-preview/
Outcome: Requests fail with [Error] Bad Request: ApiError("error decoding response body")

Request:

Please provide guidance on how to correctly configure an Azure OpenAI-compatible endpoint in Stakpak, specifically how to set the api_version required by Azure.
If Stakpak supports Azure OpenAI, is there a configuration key (e.g., profiles.default.openai.api_version or similar) or a different endpoint format expected?
If appending api-version in the URL is unsupported, can support be added, or can you document the correct approach?

Reproduction steps (Docker):

  1. Run container: docker run -it --entrypoint stakpak ghcr.io/stakpak/agent:latest

  2. Select: Use my own Model/API Key

  3. Select: Bring your own model

  4. Enter OpenAI-compatible API endpoint: https://rsg-dummy.openai.azure.com?api-version=2024-12-01-preview/
    Note: Endpoint masked as rsg-dummy

  5. Enter API key: myownapikey

  6. Set models:
    Smart model name: o3-mini
    Eco model name:o3-mini

  7. Configuration preview printed by Stakpak

[profiles.default]
provider="local"
smart_model="o3-mini"
eco_model="o3-mini"

[profiles.default.openai]
api_endpoint="https://rsg-dummy.openai.azure.com?api-version=2024-12-01-preview"
api_key="***"
  1. Make a request (e.g., “Dockerize my app”) → failure: [Error] Bad Request: ApiError("error decoding response body")

Observed behavior:

The endpoint and credentials work in the same environment when using the Azure OpenAI SDK with explicit api_version. This suggests the failure is due to how Stakpak constructs requests or handles the api-version parameter.

Working python code

import os
from openai import AzureOpenAI

endpoint = "https://rsg-dummy.openai.azure.com/"
model_name = "o3-mini"
deployment = "o3-mini"

subscription_key = "myownapikey"
api_version = "2024-12-01-preview"

client = AzureOpenAI(
    api_version=api_version,
    azure_endpoint=endpoint,
    api_key=subscription_key,
)

response = client.chat.completions.create(
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "I am going to Paris, what should I see?"},
    ],
    max_completion_tokens=100000,
    model=deployment,
)

print(response.choices[0].message.content)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions