Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.9 KB
Raw Blame
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { createPiece } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/pieces-framework';
import { askOpenRouterAction } from './lib/actions/ask-open-router';
import { getCreditsAction } from './lib/actions/get-credits.action';
import { getCurrentKeyAction } from './lib/actions/get-current-key.action';
import { listEmbeddingModelsAction } from './lib/actions/list-embedding-models.action';
import { listModelEndpointsAction } from './lib/actions/list-model-endpoints.action';
import { listModelsAction } from './lib/actions/list-models.action';
import { listProvidersAction } from './lib/actions/list-providers.action';
import { listUserModelsAction } from './lib/actions/list-user-models.action';
import { openRouterAuth } from './lib/auth';

export const openRouter = createPiece({
  displayName: 'OpenRouter',
  description: 'Use any AI model to generate code, text, or images via OpenRouter.ai.',
  auth: openRouterAuth,

  minimumSupportedRelease: '0.88.2',

  logoUrl: 'https://cdn.activepieces.com/pieces/open-router.png',
  categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
  authors: ["Salem-Alaa","kishanprmr","MoShizzle","abuaboud"],
  actions: [
    askOpenRouterAction,
    listModelsAction,
    listEmbeddingModelsAction,
    listUserModelsAction,
    listModelEndpointsAction,
    listProvidersAction,
    getCreditsAction,
    getCurrentKeyAction,
    createCustomApiCallAction({
      baseUrl: () => 'https://openrouter.ai/api/v1',
      auth: openRouterAuth,
      authMapping: async (auth) => ({
        Authorization: `Bearer ${auth.secret_text}`,
      }),
      props: {
        url: {
          description: 'Full URL, or a path relative to https://openrouter.ai/api/v1',
          placeholder: '/models',
        },
      },
    }),
  ],
  triggers: [],
});