Skip to main content
Version: 2.0

Bring your own LLM

Organizations often need to integrate multiple Large Language Models (LLMs) from different providers to optimize cost, performance, or compliance. Vectara's Bring Your Own LLM (BYO-LLM) capability enables seamless integration of third-party LLMs into Vectara's AI stack, supporting OpenAI-compatible models, resposes API for reasoning models, and Google Cloud Vertex AI.

By configuring LLMs with the Create LLM API, you can enhance flexibility in how Vectara generates summaries, answers, and content, leveraging your preferred LLM infrastructure while retaining full compatibility with Vectara's powerful RAG workflows.

For example, models like GPT-5, Claude Sonnet, and Opus excel at generating code and technical content as part of your text responses. In your applications, you could use advanced models to generate code within Vectara responses, while leveraging multimodal models' image generation capabilities through separate API calls.

Discover LLM configurations

Instead of hand-configuring every field, you can let Vectara figure out the configuration for you. Send an endpoint URL and any credential the provider accepts to the Discover LLMs endpoint, and Vectara infers the provider type and API dialect, enumerates the models the endpoint exposes, and live-tests up to three models per detected endpoint. It returns candidate configurations: add a name and the credential you supplied, then submit them to Create LLM.

Discovery does not persist anything, but it is not free of side effects: it makes live generation calls to the provider to verify a candidate, which the provider may bill.

The provider type is inferred from the credential shape and the URL host, so you often only need the credential:

  • AWS credentials imply anthropic (Claude on Amazon Bedrock).
  • A vertex_service_account or vertex_access_token credential implies anthropic (Claude on Vertex AI); a service_account or api_key credential implies vertex-ai (Gemini).
  • An api.anthropic.com host implies anthropic (direct API). A generativelanguage.googleapis.com host implies vertex-ai via Google AI Studio.
  • Anything else is treated as an OpenAI-compatible host, and both the openai-compatible (chat-completions) and openai-responses (reasoning) dialects are probed.

Set the optional type field to restrict discovery to a single provider when you already know it. The uri is optional when the credential itself identifies the provider: Anthropic (sk-ant-…) and OpenAI (sk-…) API keys, Bedrock credentials (region-derived endpoint), vertex_service_account and vertex_access_token credentials (project/region-derived endpoint), and the Gemini api_key credential, whose endpoint defaults to Google AI Studio. Any other credential — including the Gemini service_account credential, which declares no project or region — needs a uri.

Request Body

DISCOVER REQUEST EXAMPLE

Code example with json syntax.
1

cURL Example

DISCOVER CURL EXAMPLE

Code example with bash syntax.
1

Successful Response

Each candidate carries the type and model to submit to Create LLM, inferred capabilities, and whether a live generation call against that model succeeded (verified). A normalized uri is included except for providers whose endpoint derives from the credential (Bedrock, and Vertex without a base URI). Candidates that verified are listed first.

DISCOVER RESPONSE EXAMPLE

Code example with json syntax.
1

Model capabilities

The capabilities object records what a model can do. If you omit it when you create an LLM, Vectara infers the capabilities from the model name and provider type; any field you set explicitly overrides the inferred default.

FieldDescription
image_supportWhether the model accepts image inputs.
context_limitMaximum context window size in tokens (minimum 4096).
tool_callingWhether the model supports tool and function calling.
structured_outputsWhether the model supports structured output generation.
requires_role_alternationWhether the model requires strict role alternation in a conversation. When true, Vectara groups consecutive messages of the same role together before sending them.

Limit requests per second

Set the optional requests_per_second field to cap how fast Vectara calls a model. The value ranges from 1 to 10000, and Vectara rejects requests above the limit with HTTP 429. The field is available on all four LLM types.

The semantics differ between creating and updating a configuration:

  • On create, omit the field or set it to null to apply no limit.
  • On update, set a value to apply that limit, set the field to null to remove the limit, or omit the field to keep the current limit.

A read of the configuration omits requests_per_second entirely when the model has no limit.

Define a custom LLM configuration

The integration relies on defining a custom LLM configuration with the Create LLM endpoint. Vectara supports four LLM types:

Supported LLM Types

TypeDescriptionUse For
openai-compatibleOpenAI-style APIsOpenAI, Azure OpenAI, self-hosted vLLM, OpenRouter
openai-responsesOpenAI Responses APIReasoning models (o1, o3)
vertex-aiGoogle Cloud Vertex AIGemini models
anthropicAnthropic Claude (direct API, Amazon Bedrock, or Vertex)Claude models

After you enter the type, continue with the remaining configuration fields:

Configuration Fields

FieldDescription
typeOne of the following: openai-compatible, openai-responses, vertex-ai, or anthropic
nameUser-defined label for the LLM (referenced in queries)
description(Optional) Metadata or notes about the model
modelSpecific model version (gpt-4, claude-3.5-sonnet, gemini-2.5-flash)
uriThe API endpoint URL. Optional for anthropic: it defaults to the direct Anthropic API, and Bedrock and Vertex endpoints derive from the credential's region or project
authAuthentication configuration (varies by type)
headers(Optional) Additional HTTP headers for the API
test_model_parameters(Optional) Test parameters to validate the configuration

Add custom LLM examples

Here are some examples for Anthropic, OpenAI, and Google LLMs.

Add Anthropic Claude 3.7 Sonnet

Request Body

REQUEST EXAMPLE

Code example with json syntax.
1

cURL Example

CLAUDE EXAMPLE

Code example with json syntax.
1

Successful Response

RESPONSE EXAMPLE

Code example with json syntax.
1

Add OpenAI GPT-4o

GPT-4O MINI EXAMPLE

Code example with json syntax.
1

Add Google Gemini (Vertex AI)

Using API Key Authentication

GOOGLE GEMINI EXAMPLE

Code example with json syntax.
1

Using Service Account Authentication

SERVICE ACCOUNT EXAMPLE

Code example with json syntax.
1

Add OpenAI Reasoning Models (o1, o3)

OPENAI O1 EXAMPLE

Code example with json syntax.
1

Verify your configuration

To confirm your model was added successfully:

VERIFICATION EXAMPLE

Code example with bash syntax.
1

Look for your model in the response JSON and verify it has "enabled": true.

The response also echoes back the auth variant the model was created with, so you can confirm you configured the credential you intended. Every secret value is replaced by the literal string ****. The non-secret identifiers around it are preserved — header names, regions, AWS access key IDs, and the GCP project and region — so you can recognize the configured credential without exposing it.

To rotate a credential, submit a new auth object with a PATCH. Omit auth to keep the existing credentials.

Querying with a custom LLM

After you register a third-party LLM using the /v2/llms endpoint, you do not reference it directly by ID in your query. Instead, you associate the custom LLM with a generation preset, and then use that preset in your query with generation_preset_name.

However, when defining custom model_parameters, you can override the default preset and explicitly specify the registered model by name.

Example query

QUERY CUSTOM LLM EXAMPLE

Code example with json syntax.
1

Add Openrouter models

Claude Sonnet 4.5

CLAUDE SONNET 4.5 EXAMPLE

Code example with bash syntax.
1

GLM 4.6

GLM 4.6 EXAMPLE

Code example with bash syntax.
1

Minimax 2

MINIMAX 2 EXAMPLE

Code example with bash syntax.
1

xAI Grok Code Fast 1

GROK CODE FAST 1 EXAMPLE

Code example with bash syntax.
1