> ## Documentation Index
> Fetch the complete documentation index at: https://docs.optexity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Configuration

> Choose the LLM models your automations run on

Every LLM call in Optexity runs on [Google Vertex AI](https://cloud.google.com/vertex-ai): Gemini first, with Claude as the fallback. Calls are authenticated with Application Default Credentials, so there are no model API keys.

## Setup

1. In your Google Cloud project, enable the **Vertex AI API**.
2. In **Vertex AI → Model Garden**, enable the Claude models used as fallbacks (`claude-haiku-5-5`, `claude-sonnet-5-5`, `claude-opus-5-5`).
3. Sign in: `gcloud auth application-default login` locally, or set `GOOGLE_APPLICATION_CREDENTIALS` to a service-account key file on a server.

## Environment Variables

| Variable | Type | Default | Description |
| - | - | - | - |
| `GOOGLE_CLOUD_PROJECT` | `str` | — | Google Cloud project for every LLM call |
| `GOOGLE_CLOUD_LOCATION` | `str` | `us` | Vertex AI location: `us` (data stays in the US) or `global` (about 10% cheaper for Claude) |
| `GOOGLE_CREDENTIALS_JSON` | `str \| None` | `None` | Service-account key as JSON text, for runtimes that can't mount a key file (used when `GOOGLE_APPLICATION_CREDENTIALS` isn't set) |
| `LLM_MODEL` | `str \| None` | `None` | Model for calls that don't choose one (default: the `lite` tier) |
| `LLM_MODEL_FALLBACK` | `str \| None` | `None` | Backup model for `LLM_MODEL` and `llm_model_name` overrides |
| `LLM_TIER_LITE` / `LLM_TIER_STANDARD` / `LLM_TIER_PRO` | `str \| None` | `None` | Comma-separated models that replace a tier |
| `LLM_SERVICE_NAME`, `LLM_ENVIRONMENT` | `str` | `optexity`, `dev` | Tags on every call, for cost and usage reports |
| `LLM_CLOUD_LOGGING` | `bool` | `false` | Also send one log entry per LLM call to Google Cloud Logging |
| `LLM_LOG_CONTENT` | `bool` | `false` | Add the prompt and response text to each entry; images and files appear as placeholders, and text over \~180k characters loses its middle |

## Tiers

| Tier | Models, in fallback order | Used by |
| - | - | - |
| `lite` | `gemini-3.5-flash-lite`, `claude-haiku-5-5` | Default for every call that doesn't choose a model |
| `standard` | `gemini-3.6-flash`, `claude-sonnet-5-5` | — |
| `pro` | `gemini-3.1-pro-preview`, `claude-opus-5-5` (`us`: `gemini-4-argon`, `claude-opus-5-5`) | Captcha solving |

## Model IDs

Use Vertex model IDs, such as `gemini-3.6-flash`, `gemini-4-argon` or `claude-sonnet-5-5`.

Model strings saved in older automations keep working: `gemini/gemini-2.5-flash` and `anthropic/claude-sonnet-4-6` are converted, and models Vertex no longer serves run on a current model of the same strength (for example `gemini-2.5-pro` runs on the `pro` tier). Models Vertex doesn't offer, such as OpenAI models, run on the default models. Optexity logs a warning in both cases; update the saved value when you next edit the automation.

## Resolution Order

| Priority | Source | Example |
| - | - | - |
| 1 | Action-level `llm_model_name` | `extraction_action.llm.llm_model_name` |
| 2 | Task-level `llm_model_name` | Top-level field on the automation |
| 3 | `LLM_MODEL` environment variable | `gemini-3.6-flash` |
| 4 | The `lite` tier | `gemini-3.5-flash-lite` |

### Action-Level Override

Give a single action a stronger (or cheaper) model than the rest of the automation:

```json theme={null}
{
  "type": "action_node",
  "extraction_action": {
    "llm": {
      "extraction_format": { "invoice_total": "str" },
      "extraction_instructions": "Read the invoice total from the summary table.",
      "llm_model_name": "gemini-4-argon"
    }
  }
}
```

Actions that accept `llm_model_name`: `extraction_action.llm`, `extraction_action.pdf`, `extraction_action.locator`, `misc_action.llm_query`, `dynamic_form_mapping_action`, and `interaction_action.captcha`.

> [!NOTE]
>
> Captcha solving uses the `pro` tier unless the captcha action sets `llm_model_name`, because captcha grids need a stronger vision model.

## Fallbacks

A call that hits a rate limit, an outage or a model that can't serve it moves to the next model automatically:

* A model chosen with `llm_model_name` or `LLM_MODEL` falls back to `LLM_MODEL_FALLBACK` if set, otherwise to the other models in its tier (the `standard` tier if the model isn't in one).
* Tier calls (default calls, captcha) fall back within their tier.
* Temporary errors are retried once on the same model, and output that doesn't match the requested format is retried up to twice, before moving on.

## Cost Tracking

Token usage is reported per task from Vertex AI's token counts. Cost is estimated from list prices (non-global locations such as `us` are priced 10% higher); the billed amount is in Google Cloud Billing, where calls are tagged with `service`, `feature`, `environment` and `tier` labels.

## Migrating from LiteLLM

| Before | After |
| - | - |
| `GOOGLE_API_KEY`, `LLM_MODEL_API_KEY`, `LLM_MODEL_FALLBACK_API_KEY`, provider keys | Removed — set `GOOGLE_CLOUD_PROJECT` and sign in with Application Default Credentials |
| `LLM_MODEL=gemini/gemini-3.5-flash-lite` | `LLM_MODEL=gemini-3.5-flash-lite`, or leave it unset |
| `"llm_provider": "gemini", "llm_model_name": "gemini-2.5-flash"` | `"llm_model_name": "gemini-3.6-flash"` |

`llm_provider` is deprecated. Automations that still set it keep working.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.