# Query Parameters (https://www.librechat.ai/docs/features/url_query)

LibreChat can configure a chat conversation directly from the URL. Append query parameters to a chat path to choose the endpoint and model, pre-fill the input, or override conversation settings before the chat loads.

## Chat Paths

Query parameters must follow a valid chat path:

- New conversations: `/c/new?`
- Existing conversations: `/c/[conversation-id]?` (where `conversation-id` is an existing one)

```bash
https://your-domain.com/c/new?endpoint=ollama&model=llama3%3Alatest
https://your-domain.com/c/03debefd-6a50-438a-904d-1a806f82aad4?endpoint=openAI&model=o1-mini
```

## Basic Usage

The `endpoint` and `model` parameters cover most cases. Set both for predictable results:

```bash
https://your-domain.com/c/new?endpoint=azureOpenAI&model=o1-mini
```

### Endpoint selection

Use `endpoint` on its own to switch endpoints without naming a model:

```bash
https://your-domain.com/c/new?endpoint=google
```

When only `endpoint` is set, LibreChat falls back to the last model selected for that endpoint (from `localStorage`). If there is no previous selection, it uses the first model in the endpoint's list.

The `endpoint` value must be one of:

```bash
openAI, azureOpenAI, google, anthropic, assistants, azureAssistants, bedrock, agents
```

For a [custom endpoint](/docs/quick_start/custom_endpoints), use its configured name as the value (case-insensitive):

```bash
# endpoint=perplexity for a custom endpoint named `Perplexity`
https://your-domain.com/c/new?endpoint=perplexity&model=llama-3.1-sonar-small-128k-online
```

### Model selection

Use `model` on its own to switch models within the current endpoint:

```bash
https://your-domain.com/c/new?model=gpt-4o
```

When only `model` is set, LibreChat applies it only if the model exists in the current endpoint. The current endpoint is the default endpoint or the last one selected.

### Prompt

The `prompt` parameter pre-populates the chat input:

```bash
https://your-domain.com/c/new?prompt=Explain quantum computing
```

`q` is an interchangeable shorthand for `prompt`:

```bash
https://your-domain.com/c/new?q=Explain quantum computing
```

Combine it with other parameters:

```bash
https://your-domain.com/c/new?endpoint=anthropic&model=claude-3-5-sonnet-20241022&prompt=Explain quantum computing
```

### Automatic submission

Add `submit=true` to send the prompt automatically, without manual confirmation:

```bash
https://your-domain.com/c/new?prompt=Explain quantum computing&submit=true
```

This is useful for automated workflows (Raycast, Alfred, Automator) and external integrations. Combine it with the other parameters for a fully scripted launch:

```bash
https://your-domain.com/c/new?endpoint=openAI&model=gpt-4&prompt=Explain quantum computing&submit=true
```

## URL Encoding

Special characters in query values must be URL-encoded. Common substitutions:

| Character | Encoded |
| --------- | ------- |
| `:`       | `%3A`   |
| `/`       | `%2F`   |
| `?`       | `%3F`   |
| `#`       | `%23`   |
| `&`       | `%26`   |
| `=`       | `%3D`   |
| `+`       | `%2B`   |
| Space     | `%20` (or `+`) |

For example:

```ts
Original: `Write a function: def hello()`
Encoded: `/c/new?prompt=Write%20a%20function%3A%20def%20hello()`
```

JavaScript's built-in `encodeURIComponent()` handles the encoding for you:

```javascript
const prompt = "Write a function: def hello()";
const encodedPrompt = encodeURIComponent(prompt);
const url = `/c/new?prompt=${encodedPrompt}`;
console.log(url);
```

Run this in your browser console (`Ctrl+Shift+I`) to see the encoded URL.

## Specs, Agents, and Assistants

### Model specs

Select a [model spec](/docs/configuration/librechat_yaml/object_structure/model_specs) by name:

```bash
https://your-domain.com/c/new?spec=meeting-notes-gpt4
```

This loads every setting defined by the spec. Other model parameters in the URL are ignored when `spec` is present.

### Agents

Load an agent by ID without naming an endpoint:

```bash
https://your-domain.com/c/new?agent_id=your-agent-id
```

This sets the endpoint to `agents` automatically.

### Assistants

Load an assistant by ID the same way:

```bash
https://your-domain.com/c/new?assistant_id=your-assistant-id
```

This sets the endpoint to `assistants` automatically.

## Supported Parameters

### LibreChat settings

| Parameter | Description |
| --------- | ----------- |
| `maxContextTokens` | Override the system-defined context window. |
| `resendFiles` | Control file resubmission in subsequent messages. |
| `promptPrefix` | Set custom instructions / system message. |
| `imageDetail` | Image quality: `low`, `auto`, or `high`. Applies only to OpenAI, OpenAI-like custom endpoints, and Azure OpenAI (defaults to `auto`). |
| `spec` | Select a [model spec](/docs/configuration/librechat_yaml/object_structure/model_specs) by exact name. When set, other model parameters are ignored in favor of the spec. If specs are configured with `enforce: true`, this parameter may be required for URL query params to work. |
| `fileTokenLimit` | Maximum token limit for file processing, to control cost and resource usage. The request value overrides the YAML default. |

### Model parameters

Supported model parameters vary by endpoint. Values must be valid according to the provider's API.

**OpenAI, Custom, Azure OpenAI:**

```bash
temperature, presence_penalty, frequency_penalty, stop, top_p, max_tokens,
reasoning_effort, reasoning_summary, verbosity, useResponsesApi, web_search, disableStreaming
```

**Google, Anthropic:**

```bash
topP, topK, maxOutputTokens, thinking, thinkingBudget, thinkingLevel, web_search, url_context
```

For Google endpoints, set `url_context=true` to let supported Gemini text models read URLs included in the user message. YouTube URLs are handled with native video understanding when URL Context is enabled.

**Anthropic, Bedrock (Anthropic models), OpenRouter custom endpoints:**

Set `promptCache` to `true` or `false` to toggle prompt caching. Set `promptCacheTtl` to `5m` or `1h` to choose the cache lifetime when prompt caching is enabled:

```bash
promptCache
promptCacheTtl=1h
```

See the [Anthropic prompt caching docs](https://www.anthropic.com/news/prompt-caching) and the [Bedrock prompt caching docs](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html#prompt-caching-get-started) for details.

**Bedrock:**

```bash
# Bedrock region
region=us-west-2
# Bedrock equivalent of `max_tokens`
maxTokens=200
# Bedrock reasoning effort (for supported models like ZAI, MoonshotAI)
reasoning_effort=medium
```

**Assistants / Azure Assistants:**

```bash
# Overrides existing assistant instructions for the current run
instructions=your+instructions
```

```bash
# Adds the current date and time to `additional_instructions` for each run
append_current_datetime=true
```

Most of these parameters are shared with [Model Spec Preset Fields](/docs/configuration/librechat_yaml/object_structure/model_specs); refer there for the full reference.

### Examples

Multiple parameters in one URL:

```bash
https://your-domain.com/c/new?endpoint=google&model=gemini-2.0-flash-exp&temperature=0.7&prompt=Oh hi mark
```

Loading a model spec with a prompt:

```bash
https://your-domain.com/c/new?spec=meeting-notes-gpt4&prompt=Here%20is%20the%20transcript...
```

When using `spec`, other model parameters are ignored in favor of the spec's configuration.

## Validation

All parameters are validated against LibreChat's schema before they are applied. Invalid parameters and values are ignored; valid settings are applied to the conversation.

<Callout type="warning" title="Use query parameters carefully">
- Misuse or exceeding provider limits can produce API errors.
- If you hit a bad request error, reset the conversation by clicking **New Chat**.
- A parameter has no effect if the selected endpoint does not support it.
</Callout>

## Best Practices

1. Set both `endpoint` and `model` whenever possible.
2. Confirm the endpoint supports each parameter you pass.
3. Keep values within the provider's limits.
4. Test parameter combinations before sharing URLs.

Query parameters make it easy to share specific conversation configurations, bookmark different chat setups, and automate chat startup from external tools.
