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 configuration to set as active. You can get this from the llmProvidersByOrganization query.

Step 1: Execute the Mutation

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

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

Arguments

  • providerId (ID, required): The ID of the LLM provider configuration to activate.
  • ownerType (Enum, required): The type of owner. Must be assistant or organization.
  • ownerId (String, required): The ID of the target assistant or organization.

Response Fields

  • activeLlmProvider: The newly activated provider link, containing:
    • id: Unique ID of the active provider setting.
    • providerId: The ID of the activated LLM provider configuration.
    • ownerId: The ID of the assistant or organization.
    • ownerType: The type of owner (assistant or organization).

Example Response

{
  "data": {
    "setActiveLlmProvider": {
      "activeLlmProvider": {
        "id": "15",
        "providerId": "27",
        "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.