Skip to content

feat: support OpenAI-compatible endpoints in native agent - #1475

Closed
RomainZento wants to merge 1 commit into
micro:mainfrom
RomainZento:feat/openai-compatible-native-agent
Closed

RomainZento wants to merge 1 commit into
micro:mainfrom
RomainZento:feat/openai-compatible-native-agent

Conversation

@RomainZento

Copy link
Copy Markdown

Summary

Adds support for OpenAI-compatible endpoints to Mu's native agent.

Mu already supports configuring OPENAI_BASE_URL, OPENAI_API_KEY, and
OPENAI_MODEL, but the native agent did not forward the configured BaseURL
to go-micro.

As a result, OpenAI-compatible providers could be detected as configured
without actually being usable by the native agent.

Changes

  • Add OpenAI-compatible provider resolution to nativeLLM()
  • Use OPENAI_BASE_URL, OPENAI_API_KEY, and OPENAI_MODEL
  • Forward the configured BaseURL to go-micro using agent.BaseURL
  • Preserve the existing Anthropic, Atlas Cloud, and OpenRouter behavior
  • Add tests covering provider, API key, model, and BaseURL selection
  • Update go-micro to a version supporting agent.BaseURL

The implementation is provider-agnostic and should work with OpenAI-compatible
endpoints such as Gemini, Ollama, LM Studio, vLLM, and others.

Testing

Tested successfully with Google's Gemini OpenAI-compatible endpoint using:

gemini-2.5-flash

Both regular responses and native tool calling were verified successfully.

go test ./agent passes.

The full test suite also passes apart from environment-dependent tests requiring
Docker/Linux container support.

@asim

asim commented Aug 31, 2026

Copy link
Copy Markdown
Member

@codex fix the conflicts

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • Merged the latest main branch and resolved conflicts while preserving current per-agent model and provider selection behavior.
  • Added propagation of configured OpenAI-compatible base URLs through gmagent.BaseURL, allowing native agents to use endpoints configured with OPENAI_BASE_URL. agent/native.goL255-L258 agent/native.goL303-L333
  • Extended native provider resolution to return the endpoint base URL and use OPENAI_MODEL, with gpt-4o-mini as the fallback model. agent/native.goL361-L372 agent/native.goL423-L457
  • Retained the latest Anthropic, Atlas, Gemini, and OpenRouter resolution logic from main. agent/native.goL392-L450
  • Updated tests to verify provider, API key, model, base URL, and constructed-agent option selection for OpenAI-compatible endpoints. agent/nativellm_test.goL99-L132
  • Committed the resolution as e497523 and opened replacement pull request #1477.

Testing

  • ✅ go test ./agent
  • ✅ test -z "$(gofmt -l .)"
  • ✅ rg '^(<<<<<<<|=======|>>>>>>>)' --glob '!vendor/**' . || true
  • ⚠️ git diff --check (reports trailing whitespace already present in files merged from main, including README.md and internal/app/html/mu.css; the conflict-resolution files pass formatting checks)

View task →

@asim

asim commented Aug 31, 2026

Copy link
Copy Markdown
Member

Merged here #1477

@asim asim closed this Aug 31, 2026
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.

2 participants