Skip to content

feat: add NEAR AI Cloud provider#8169

Open
PierreLeGuen wants to merge 2 commits into
janhq:mainfrom
PierreLeGuen:nearai-provider
Open

feat: add NEAR AI Cloud provider#8169
PierreLeGuen wants to merge 2 commits into
janhq:mainfrom
PierreLeGuen:nearai-provider

Conversation

@PierreLeGuen
Copy link
Copy Markdown

@PierreLeGuen PierreLeGuen commented May 21, 2026

Describe Your Changes

  • Add NEAR AI Cloud as a predefined OpenAI-compatible remote provider using https://cloud-api.near.ai/v1.
  • Refresh NEAR AI model choices from the live /model/list catalog and filter out non-chat utility, embedding, image, transcription, and reranker entries.
  • Add provider display naming, focused unit coverage, and a desktop remote-models docs page.

Testing

  • yarn vitest run --project @janhq/web-app web-app/src/constants/__tests__/nearai-provider.test.ts web-app/src/lib/__tests__/remoteModelCatalog.test.ts web-app/src/lib/__tests__/model-factory.test.ts web-app/src/lib/__tests__/utils.test.ts
  • yarn workspace @janhq/web-app eslint src/constants/models.ts src/constants/providers.ts src/lib/remoteModelCatalog.ts src/lib/model-factory.ts src/lib/utils.ts
  • yarn workspace @janhq/web-app tsc -b --pretty false

Self Checklist

  • Updated docs

@PierreLeGuen PierreLeGuen marked this pull request as ready for review May 21, 2026 15:36
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8ad35f086

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web-app/src/constants/providers.ts
@tokamak-pm
Copy link
Copy Markdown

tokamak-pm Bot commented Jun 3, 2026

Review: feat: add NEAR AI Cloud provider

Summary

This PR adds NEAR AI Cloud as a new predefined OpenAI-compatible remote provider with endpoint . It includes model catalog fetching from the NEAR AI endpoint, filtering of non-chat models (image generation, embeddings, rerankers, transcription, utility), documentation, and test coverage.

Strengths

  • Good filtering logic: The function properly filters out non-chat models by checking input/output modalities, excluding embeddings, image generation, rerankers, whisper, and the privacy-filter utility model. The scoring by and is a thoughtful touch for ranking TEE-backed models higher.
  • Comprehensive test coverage: Tests cover the provider definition, model catalog normalization, model factory integration, provider title mapping, and the Tauri fetch path. The test data includes good edge cases (missing modalities, various model types).
  • Documentation: The page is well-structured and follows the existing pattern of other provider docs.
  • Consistent integration pattern: The changes follow the established patterns in , , , , and .

Issues and Concerns

  1. Catalog path divergence in retry loop (): The NEAR AI early return () inside the retry loop means NEAR AI will never retry on success with bad data or benefit from the multi-attempt logic the same way other providers do. If the first attempt succeeds with an HTTP 200 but returns unexpected data, it will return empty results rather than trying the next auth strategy. This is likely fine since NEAR AI uses a single auth approach, but worth noting.

  2. Hardcoded model exclusion (): The line uses a hardcoded model ID exclusion. If NEAR AI adds more utility models in the future, they could leak through. Consider using the modality-based filtering alone (which already handles most cases) or adding a comment explaining why this specific model needs extra exclusion (e.g., it passes modality checks but is not a chat model).

  3. ** may be too broad** (): The entry in sets , but this depends on the specific model. Some NEAR AI models support vision and some do not. The capability detection in correctly distinguishes vision models, but the global provider flag could be misleading. This is consistent with how other providers handle it, though.

  4. All capabilities assumed (): Every NEAR AI model that passes the filter gets capabilities. Not all models on every cloud provider actually support tool calling. If NEAR AI exposes tool-calling metadata, it would be more accurate to conditionally include it.

  5. Trailing slash handling (): The normalization is a good addition for NEAR AI but is only applied in the path. The path does not strip trailing slashes, which could result in double-slash URLs if a user adds a trailing slash to the base URL.

  6. Minor: The diff also fixes a missing newline at end of file, which is good but could have been a separate commit for cleanliness.

Missing

  • No integration/e2e tests verifying actual API connectivity (understandable for a community contribution).
  • No error handling test for when the NEAR AI catalog endpoint is unreachable.

Merge Readiness

The PR is well-structured, follows existing patterns, and includes solid test coverage. The issues identified are minor and mostly relate to future-proofing rather than correctness bugs.

Recommendation: can merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant