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_accountorvertex_access_tokencredential impliesanthropic(Claude on Vertex AI); aservice_accountorapi_keycredential impliesvertex-ai(Gemini). - An
api.anthropic.comhost impliesanthropic(direct API). Agenerativelanguage.googleapis.comhost impliesvertex-aivia Google AI Studio. - Anything else is treated as an OpenAI-compatible host, and both the
openai-compatible(chat-completions) andopenai-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.
| Field | Description |
|---|---|
image_support | Whether the model accepts image inputs. |
context_limit | Maximum context window size in tokens (minimum 4096). |
tool_calling | Whether the model supports tool and function calling. |
structured_outputs | Whether the model supports structured output generation. |
requires_role_alternation | Whether 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
nullto apply no limit. - On update, set a value to apply that limit, set the field to
nullto 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
| Type | Description | Use For |
|---|---|---|
openai-compatible | OpenAI-style APIs | OpenAI, Azure OpenAI, self-hosted vLLM, OpenRouter |
openai-responses | OpenAI Responses API | Reasoning models (o1, o3) |
vertex-ai | Google Cloud Vertex AI | Gemini models |
anthropic | Anthropic Claude (direct API, Amazon Bedrock, or Vertex) | Claude models |
After you enter the type, continue with the remaining configuration fields:
Configuration Fields
| Field | Description |
|---|---|
type | One of the following: openai-compatible, openai-responses, vertex-ai, or anthropic |
name | User-defined label for the LLM (referenced in queries) |
description | (Optional) Metadata or notes about the model |
model | Specific model version (gpt-4, claude-3.5-sonnet, gemini-2.5-flash) |
uri | The 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 |
auth | Authentication 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