Skip to content

Feat/OpenAI compatible provider - #23

Open
timotheegath wants to merge 9 commits into
umass-aisec:mainfrom
timotheegath:feat/openai-compatible-provider
Open

timotheegath wants to merge 9 commits into
umass-aisec:mainfrom
timotheegath:feat/openai-compatible-provider

Conversation

@timotheegath

Copy link
Copy Markdown
Contributor

Let the environment use a custom Open-AI-compatible LLM provider be use for inference for all environments.

Desired behaviour

  1. The environment MUST be able to perform inference with any Open-AI-compatible LLM provider
  2. Given the user has chosen a custom OAI-compatible provider for an environment configuration, the environment must run all functionality successfully as it would with any other provider
  3. The user MUST provide a custom base URL and API key in an .env file or any other file as specified in the environment config.
  4. All environments should support this new custom OAI-compatible provider.

Implementation notes

  • A new OpenAICompatibleClient subclasses OpenAIClient, as by design the specs should be nearly identical. The only difference is endpoint specs and credentials handling.
  • Comment added for completeness in example config files
  • New config option added in .env.example to hint at the required variables.
  • Fixed the handling of reasoning/CoT traces: some custom OAI-compatible providers store reasoning in a different object. They are now fetched properly.

timotheegath and others added 9 commits November 25, 2026 13:12
Subclasses OpenAIClient so the Responses API, tool-call handling, retries, and usage accounting are inherited unchanged; only the base URL and API key resolution is added. Both default to the OPENAI_COMPATIBLE_BASE_URL / OPENAI_COMPATIBLE_API_KEY env vars from .env and raise a clear error when unset.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Adds the lazy-loading entry so the client is importable from the public clients namespace like the other providers.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Registers the provider in get_client_instance (resolving base_url/api_key from the openai_compatible config block or OPENAI_COMPATIBLE_* env vars), get_model_name, and extract_model_info; adds openai-compatible/openai_compat aliases and lists the provider in the unknown-provider error.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…example

Template entries for the new openai_compatible provider; real values stay in the gitignored .env.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Adds an openai_compatible llm block (model/params plus commented base_url and env-var overrides) and lists the provider in the provider comment, matching how the other providers are shown.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Mirrors test_grok_client.py: mocks the openai SDK, then covers env-based base URL/API key resolution, custom env var names, explicit-arg overrides, the missing-credential errors, and a Responses API passthrough keeping temperature for a non-restricted model.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Extends the existing namespace smoke test with the new client in clients.__all__ and adds an openai-compatible -> openai_compatible alias test mirroring the foundary/xai ones.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
… field

The trajectory 'reasoning' field was filled from response_str (output_text
only), so reasoning-model turns that emit reasoning + tool calls logged an
empty string. Extract text from reasoning output items (both OpenAI-style
summary parts and gateway-style reasoning_text content parts, e.g.
OpenRouter) and prefer it over output_text; message text remains available
in the response_output_text diagnostic.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

This branch has not been deployed

No deployments
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