Skip to content

feat(ai): Add support for Snowflake Cortex and OpenAI gateways#147

Open
almahirpmf wants to merge 1 commit into
droid-ash:mainfrom
almahirpmf:feat/snowflake-cortex-support
Open

feat(ai): Add support for Snowflake Cortex and OpenAI gateways#147
almahirpmf wants to merge 1 commit into
droid-ash:mainfrom
almahirpmf:feat/snowflake-cortex-support

Conversation

@almahirpmf

Copy link
Copy Markdown

Summary

Added environment variables to allow routing traffic to custom endpoints like Snowflake Cortex, without altering the default behavior for standard OpenAI users.

Changes included:
Support for OPENAI_BASE_URL and OPENAI_EXTRA_HEADERS_JSON to override the default api.openai.com endpoint and pass required custom headers.

Added FINALRUN_OPENAI_SNOWFLAKE_COMPAT=1 flag to intercept the underlying fetch call and map max_tokens to max_completion_tokens (required by Snowflake Cortex).

Added FINALRUN_OPENAI_USE_CHAT=1 flag to force the use of Chat Completions (openai.chat) instead of the default Responses API (openai.responses), avoiding 403 errors on /v1/responses for gateways that only support the chat-compatible endpoint.

The default behavior for standard OpenAI usage is kept exactly the same.

Validation

  • npm run build
  • npm test
  • npm run lint
  • Additional manual verification noted below:

Manually verified that finalRun successfully connects to Android using Snowflake Cortex as the API key gateway when using the new environment variables.

Notes

Call out platform-specific behavior, follow-up work, or known limitations.

Added environment variables to allow routing traffic to custom endpoints like Snowflake Cortex, without altering the default behavior for standard OpenAI users.

Changes included:
- Support for OPENAI_BASE_URL and OPENAI_EXTRA_HEADERS_JSON to override the default api.openai.com endpoint and pass required custom headers.
- Added FINALRUN_OPENAI_SNOWFLAKE_COMPAT=1 flag to intercept the underlying fetch call and map max_tokens to max_completion_tokens (required by Snowflake Cortex).
- Added FINALRUN_OPENAI_USE_CHAT=1 flag to force the use of Chat Completions (openai.chat) instead of the default Responses API (openai.responses), avoiding 403 errors on /v1/responses for gateways that only support the chat-compatible endpoint.

The default behavior for standard OpenAI usage is kept exactly the same.
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