Skip to content

feat(compat-oai): add Novita AI provider plugin#4974

Closed
Alex-wuhu wants to merge 1 commit intogenkit-ai:mainfrom
Alex-wuhu:novita-integration
Closed

feat(compat-oai): add Novita AI provider plugin#4974
Alex-wuhu wants to merge 1 commit intogenkit-ai:mainfrom
Alex-wuhu:novita-integration

Conversation

@Alex-wuhu
Copy link

Summary

Adds Novita AI as a new OpenAI-compatible provider in the @genkit-ai/compat-oai plugin, following the same pattern as the existing DeepSeek and xAI providers.

Changes

  • js/plugins/compat-oai/src/novita/novita.ts — model definitions for the three supported chat models
  • js/plugins/compat-oai/src/novita/index.ts — plugin entry (novitaPlugin, novita export)
  • js/plugins/compat-oai/package.json — adds ./novita export path
  • js/plugins/compat-oai/tests/novita_test.ts — unit tests

Supported models

Model ID Vision Tools Constrained output
moonshotai/kimi-k2.5
zai-org/glm-5
minimax/minimax-m2.5

Usage

import { novita } from '@genkit-ai/compat-oai/novita';

const ai = genkit({
  plugins: [novita({ apiKey: process.env.NOVITA_API_KEY })],
});

const response = await ai.generate({
  model: novita.model('moonshotai/kimi-k2.5'),
  prompt: 'Hello!',
});

Auth: pass apiKey in plugin options, or set the NOVITA_API_KEY environment variable.

Base URL: https://api.novita.ai/openai (OpenAI-compatible).

Adds Novita AI as a new OpenAI-compatible provider in the compat-oai
plugin, following the same pattern as the DeepSeek and xAI providers.

- Supports moonshotai/kimi-k2.5 (vision + tools), zai-org/glm-5, and
  minimax/minimax-m2.5 chat models
- Auth via NOVITA_API_KEY env var or plugin options
- Exports @genkit-ai/compat-oai/novita entry point
- Includes unit tests mirroring existing provider test structure
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces Novita AI as a new provider to the Genkit AI OpenAI-compatible plugin. This integration expands the range of available AI models, allowing developers to leverage Novita AI's offerings within their Genkit applications. The changes include the necessary code for model definitions, plugin initialization, and robust testing to ensure seamless functionality and proper authentication.

Highlights

  • New Provider Integration: Novita AI has been added as a new OpenAI-compatible provider within the @genkit-ai/compat-oai plugin, following the established pattern of existing providers like DeepSeek and xAI.
  • Model Definitions: Model definitions for three supported chat models from Novita AI (moonshotai/kimi-k2.5, zai-org/glm-5, minimax/minimax-m2.5) have been included, detailing their capabilities such as vision, tools, and constrained output.
  • Plugin Entry and Configuration: A new plugin entry (novitaPlugin) and export (novita) have been created, allowing for easy integration and configuration with an API key, either directly or via the NOVITA_API_KEY environment variable.
  • Package Configuration Update: The package.json file has been updated to include the necessary export paths for the new Novita AI module, ensuring proper module resolution.
  • Unit Tests: Comprehensive unit tests have been added to validate the novitaModelRef functionality, SUPPORTED_NOVITA_MODELS definitions, defineCompatOpenAIModel integration, and API key authentication for the Novita plugin.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@google-cla
Copy link

google-cla bot commented Mar 22, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for Novita AI as a new OpenAI-compatible provider. The implementation follows the existing patterns for other providers like DeepSeek and xAI, including model definitions, plugin entry point, and unit tests. The code is well-structured and the changes are clear. I have one minor suggestion to improve code readability by using async/await syntax more consistently.

Comment on lines +58 to +72
return await client.models.list().then((response) =>
response.data
.filter((model) => model.object === 'model')
.map((model: OpenAI.Model) => {
const modelRef =
SUPPORTED_NOVITA_MODELS[
model.id as keyof typeof SUPPORTED_NOVITA_MODELS
] ?? novitaModelRef({ name: model.id });
return modelActionMetadata({
name: modelRef.name,
info: modelRef.info,
configSchema: modelRef.configSchema,
});
})
);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The use of await with .then() is redundant. Using async/await syntax consistently improves readability.

  return (await client.models.list()).data
      .filter((model) => model.object === 'model')
      .map((model: OpenAI.Model) => {
        const modelRef =
          SUPPORTED_NOVITA_MODELS[
            model.id as keyof typeof SUPPORTED_NOVITA_MODELS
          ] ?? novitaModelRef({ name: model.id });
        return modelActionMetadata({
          name: modelRef.name,
          info: modelRef.info,
          configSchema: modelRef.configSchema,
        });
      });

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant