Set Active LLM Provider

Define which LLM provider configuration is active for a given assistant or for the entire organization.

Before You Begin

🔗 Use the GraphQL Playground to execute the mutations in this guide.

➡️ New to GraphQL? Learn how to navigate the Playground with our Playground Basics Guide.

Prerequisites

  1. Authentication: Use a Service Account token.

  2. Permissions: You must have permissions to manage AI providers in the organization.

  3. Owner ID & Type: The ID and type (assistant or organization) of the entity for which you are setting the provider.

  4. Provider ID: The ID of the provider to set as active. You can either activate:

    You must provide exactly one of providerId or systemProviderId.

Step 1: Execute the Mutation

This mutation assigns an existing LLM provider as the active one for a specific owner (either an assistant or the entire organization).

Activating a custom (BYOM) provider

mutation {
  setActiveLlmProvider(input: { providerId: "27", ownerType: assistant, ownerId: "asst_123abc" }) {
    activeLlmProvider {
      id
      llmProviderId
      systemLlmProviderId
      ownerId
      ownerType
    }
  }
}

Activating a system provider

mutation {
  setActiveLlmProvider(input: { systemProviderId: "99", ownerType: assistant, ownerId: "asst_123abc" }) {
    activeLlmProvider {
      id
      llmProviderId
      systemLlmProviderId
      ownerId
      ownerType
    }
  }
}

Arguments

  • providerId (ID, optional): The ID of the custom (BYOM) LLM provider to activate.
  • systemProviderId (ID, optional): The ID of the system (Pipefy-managed) LLM provider to activate.
  • ownerType (Enum, required): The type of owner. Listed under OwnerProvider in the GraphQL Playground.
  • ownerId (String, required): The ID of the owner entity (e.g., an assistant's ID).

Note: providerId and systemProviderId are individually optional, but exactly one of them must be provided. Sending neither (or both) results in an error.

Response Fields

  • activeLlmProvider: The newly activated provider link, containing:
    • id: Unique ID of the active provider setting.
    • llmProviderId: The ID of the activated custom (BYOM) provider. null when a system provider is active.
    • systemLlmProviderId: The ID of the activated system provider. null when a custom provider is active.
    • ownerId: The ID of the owner entity (e.g., an assistant's ID).
    • ownerType: The type of owner. Listed under OwnerProvider in the GraphQL Playground.

Example Response

{
  "data": {
    "setActiveLlmProvider": {
      "activeLlmProvider": {
        "id": "15",
        "llmProviderId": null,
        "systemLlmProviderId": "99",
        "ownerId": "asst_123abc",
        "ownerType": "assistant"
      }
    }
  }
}

Additional Notes

  • If the specified configuration is invalid or the mutation fails, an error will be raised with a detailed message.
  • This mutation is useful for programmatically switching between different LLM providers in a multi-provider setup.
  • The visibility of this mutation may depend on feature flags being enabled for your organization.

This mutation provides a quick and reliable way to set the active LLM provider for a specific assistant or an entire organization.