Skip to content

feat: support OpenAI-compatible model endpoints - #316

Open
eshulman2 wants to merge 6 commits into
forge-sdlc:mainfrom
eshulman2:feature/openai-compatible-endpoints
Open

eshulman2 wants to merge 6 commits into
forge-sdlc:mainfrom
eshulman2:feature/openai-compatible-endpoints

Conversation

@eshulman2

Copy link
Copy Markdown
Collaborator

Summary

  • add an openai-compatible model backend for orchestration and sandbox agents
  • support multiple named endpoints with per-connection base_url and environment-backed api_key_env credentials
  • keep credential values out of model policy, traces, task files, and logs
  • support unauthenticated endpoints and legacy OPENAI_BASE_URL / OPENAI_API_KEY configuration
  • document configuration and add Chat Completions/tool-calling contract coverage

Testing

  • uv run pytest tests/unit -q (2202 passed)
  • Ruff checks for all changed Python files
  • git diff --check

Comment thread src/forge/config.py
def resolve_openai_api_key(self, api_key_env: str | None) -> str:
"""Resolve a compatible endpoint credential without serializing it into policy."""
if not api_key_env:
return self.openai_api_key.get_secret_value()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — prevent the legacy key from reaching an unauthenticated named endpoint. When a named openai-compatible connection omits api_key_env, its callers pass None here. If OPENAI_API_KEY is also set for legacy use, this returns that real credential and the agent/sandbox sends it as Bearer auth to the named connection's base_url. The documented no-key configuration should resolve to an empty/placeholder key; restrict this fallback to the legacy single-connection path.

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