# Models

Configure LLM models with provider factories, capabilities, and pricing tracking

## What are Models?

Models in Standard Agents define the LLM configurations that your agents and prompts use for AI responses. Each model configuration specifies which provider to use, the specific model ID, capabilities, fallback models for resilience, and optional pricing for cost tracking.

## Decision inference

Use `state.decide({ provider, model, context, questions })` for explicit
classification, scoring, and boolean probabilities. A decision provider is an
independent capability; it does not serve a prompt's conversational model.
[TypeSafe AI](/docs/providers/typesafe) implements this surface through Jev's native
multi-question API. Calls automatically record request, response, duration,
status, usage, and known cost in application logs. Context is supplied explicitly,
and answers enter message history only when the caller explicitly adds them.

## Quick Example

```typescript agents/models/heavy_thinking.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'heavy-thinking',
  provider: openrouter,
  model: 'moonshotai/kimi-k3',
  inputPrice: 3,
  outputPrice: 15,
});
```

Reference in a prompt:

```typescript agents/prompts/my_prompt.ts
import { definePrompt } from '@standardagents/spec';

export default definePrompt({
  name: 'my_prompt',
  toolDescription: 'Answer requests with the heavy-thinking model.',
  model: 'heavy-thinking',  // Type-safe reference
  prompt: 'You are a helpful assistant...',
});
```

## Example model choices

The examples use open-weight models with configurations named by purpose.
OpenRouter supplies live pricing for these definitions.
Use `npx @standardagents/cli@latest current-models` to review model tradeoffs.

### conversational

```typescript agents/models/conversational.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'conversational',
  provider: openrouter,
  model: 'google/gemma-4-31b-it',
});
```

### tool-reasoning

```typescript agents/models/tool_reasoning.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'tool-reasoning',
  provider: openrouter,
  model: 'nvidia/nemotron-3-ultra-550b-a55b',
});
```

### fast-response

```typescript agents/models/fast_response.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'fast-response',
  provider: openrouter,
  model: 'nvidia/nemotron-3-super-120b-a12b',
});
```

### budget

```typescript agents/models/budget.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'budget',
  provider: openrouter,
  model: 'z-ai/glm-4.7-flash',
});
```

### code-generation

```typescript agents/models/code_generation.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'code-generation',
  provider: openrouter,
  model: 'minimax/minimax-m3',
});
```

### heavy-thinking

```typescript agents/models/heavy_thinking.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'heavy-thinking',
  provider: openrouter,
  model: 'moonshotai/kimi-k3',
});
```

| Configuration     | Model                      | Example work                                     |
| ----------------- | -------------------------- | ------------------------------------------------ |
| `conversational`  | Gemma 4 31B                | Conversation with a small tool set.              |
| `tool-reasoning`  | Nemotron 3 Ultra 550B A55B | Issue triage, analysis, and orchestration.       |
| `fast-response`   | Nemotron 3 Super 120B      | Fast summarization and extraction.               |
| `budget`          | GLM 4.7 Flash              | Low-cost conversation and simple classification. |
| `code-generation` | MiniMax M3                 | Coding and code review.                          |
| `heavy-thinking`  | Kimi K3                    | Heavy reasoning with image inputs.               |

## Naming Models

> **Tip:**
>
> **Best Practice:** Name your models based on their **use case**, not the underlying model ID.

This approach provides several benefits:

- **Swap models easily** - Change the underlying model without updating prompts
- **Clear intent** - Team members understand what each model is for
- **Environment flexibility** - Use different models in dev vs production

**Good model names:**

- `heavy-thinking` - Complex reasoning tasks
- `fast-response` - Quick, simple responses
- `code-generation` - Code-focused tasks
- `eval` - Evaluation and scoring
- `budget` - Cost-conscious general use
- `creative-writing` - Creative content generation

**Avoid:**

- `kimi-k3` - Ties the name to a specific model
- `gemma-4-31b` - Same issue, hard to swap later
- `model-1` - No indication of purpose

## Model Providers

Standard Agents uses **provider factory functions** imported from provider packages. This enables typed `providerOptions`, runtime validation, and local provider definitions.

### OpenAI

```typescript
import { defineModel } from '@standardagents/spec';
import { openai } from '@standardagents/openai';

export default defineModel({
  name: 'gpt-6.1-sol',
  provider: openai,
  model: 'gpt-6.1-sol',
  // Prices change. Check https://developers.openai.com/api/docs/pricing
  // Standard rates apply to prompts up to 272K tokens.
  inputPrice: 2,
  outputPrice: 10,
  providerOptions: {
    service_tier: 'default',
  },
});
```

**API Key:** Set `OPENAI_API_KEY` environment variable

**Package:** `@standardagents/openai`

### User-Defined Providers

Use `defineProvider` when another API is compatible with a base provider but needs its own endpoint, API key, icon, model list, or pricing behavior.

```typescript agents/providers/darkbloom.ts
import { defineProvider, providerEnv } from '@standardagents/spec';
import { openai } from '@standardagents/openai';

export default defineProvider({
  name: 'darkbloom',
  label: 'Darkbloom',
  baseProvider: openai,
  config: {
    apiKey: providerEnv('DARKBLOOM_API_KEY', { valueType: 'secret' }),
    baseUrl: providerEnv('DARKBLOOM_BASE_URL', {
      valueType: 'url',
      default: 'https://api.darkbloom.dev/v1',
    }),
  },
});
```

```typescript agents/models/darkbloom_chat.ts
import { defineModel } from '@standardagents/spec';
import darkbloom from '../providers/darkbloom';

export default defineModel({
  name: 'darkbloom_chat',
  provider: darkbloom,
  model: 'darkbloom-chat',
});
```

Sub-providers inherit the base provider's `providerOptions` type. They can override any provider method with `overrides`; call `next()` inside an override to compose with the base provider, or return your own value to replace it.

### Anthropic

Anthropic's Claude models are available through a dedicated provider package built on the official `@anthropic-ai/sdk`:

```typescript
import { defineModel } from '@standardagents/spec';
import { anthropic } from '@standardagents/anthropic';

export default defineModel({
  name: 'claude-opus',
  provider: anthropic,
  model: 'claude-opus-5-5',
  // Prices change. Check https://platform.claude.com/docs/en/about-claude/pricing
  inputPrice: 4,
  outputPrice: 20,
  providerOptions: {
    cacheSystemPrompt: true,
  },
});
```

**API Key:** Set `ANTHROPIC_API_KEY` environment variable

> **Note:**
>
> **Known Anthropic pricing fallback:** Standard Agents derives the exact request cost for documented Claude models from the API's token usage buckets (including prompt-cache reads and writes), so `inputPrice` and `outputPrice` are optional for known Claude models. Set them yourself only for custom or unlisted model IDs.

**Package:** `@standardagents/anthropic`

### Cerebras

Cerebras exposes an OpenAI-compatible Chat Completions API with a dedicated provider package:

```typescript
import { defineModel } from '@standardagents/spec';
import { cerebras } from '@standardagents/cerebras';

export default defineModel({
  name: 'fast-cerebras',
  provider: cerebras,
  model: 'qwen-3.8-27b',
  // Prices change. Check https://www.cerebras.ai/pricing
  inputPrice: 0.99,
  outputPrice: 1.49,
  providerOptions: {
    service_tier: 'default',
  },
});
```

**API Key:** Set `CEREBRAS_API_KEY` environment variable

> **Note:**
>
> **Known Cerebras pricing fallback:** Standard Agents can derive request cost for documented Cerebras models when the API response includes token usage but no explicit dollar cost. For custom or private Cerebras models, keep setting `inputPrice` and `outputPrice` yourself.

**Package:** `@standardagents/cerebras`

### Google Gemini / Imagen

Google's dedicated provider uses the official `@google/genai` SDK for Gemini text generation and Imagen image generation/editing:

```typescript
import { defineModel } from '@standardagents/spec';
import { google } from '@standardagents/google';

export default defineModel({
  name: 'gemini-fast',
  provider: google,
  model: 'gemini-3.8-flash',
  providerOptions: {
    responseModalities: ['TEXT'],
  },
});
```

**API Key:** Set `GOOGLE_API_KEY` environment variable

**Package:** `@standardagents/google`

### Groq

Groq exposes low-latency chat completions through the official `groq-sdk`:

```typescript
import { defineModel } from '@standardagents/spec';
import { groq } from '@standardagents/groq';

export default defineModel({
  name: 'groq-fast',
  provider: groq,
  model: 'llama-3.1-8b-instant',
  providerOptions: {
    reasoning_format: 'parsed',
  },
});
```

**API Key:** Set `GROQ_API_KEY` environment variable

**Package:** `@standardagents/groq`

### Novita AI

Novita AI exposes an OpenAI-compatible Chat Completions API with live model catalog pricing:

```typescript
import { defineModel } from '@standardagents/spec';
import { novita } from '@standardagents/novita';

export default defineModel({
  name: 'novita-reasoning',
  provider: novita,
  model: 'deepseek/deepseek-v3.2',
  providerOptions: {
    seed: 42,
  },
});
```

**API Key:** Set `NOVITA_API_KEY` environment variable

> **Note:**
>
> **No pricing required for catalog models:** Novita's provider reads model prices from `/openai/v1/models`, including cache-read prices when available, and attaches provider-owned `usage.pricing` / `usage.cost` values. For custom or private Novita models, set `inputPrice`, `outputPrice`, and `cachedPrice` yourself.

**Package:** `@standardagents/novita`

### DeepInfra

DeepInfra provides an OpenAI-compatible Chat Completions API backed by a live public model catalog:

```typescript
import { defineModel } from '@standardagents/spec';
import { deepinfra } from '@standardagents/deepinfra';

export default defineModel({
  name: 'deepinfra-chat',
  provider: deepinfra,
  model: 'deepseek-ai/DeepSeek-V3',
  providerOptions: {
    reasoning_effort: 'high',
    service_tier: 'priority',
  },
});
```

**API Key:** Set `DEEPINFRA_API_KEY`

Catalog models carry live input, output, and cache-read pricing. DeepInfra's per-request `usage.estimated_cost` is preserved as Standard Agents `usage.cost`.

**Package:** `@standardagents/deepinfra`

### Cloudflare Workers AI

Cloudflare Workers AI exposes an OpenAI-compatible Chat Completions endpoint scoped to your Cloudflare account:

```typescript
import { defineModel } from '@standardagents/spec';
import { cloudflare } from '@standardagents/cloudflare';

export default defineModel({
  name: 'workers-fast',
  provider: cloudflare,
  model: '@cf/google/gemma-4-26b-a4b-it',
  // Prices change. Check https://developers.cloudflare.com/workers-ai/platform/pricing/
  inputPrice: 0.1,
  outputPrice: 0.3,
  providerOptions: {
    seed: 42,
  },
});
```

**Environment:** Set both `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`

**Package:** `@standardagents/cloudflare`

### OpenRouter

OpenRouter provides access to models from multiple providers (OpenAI, Anthropic, Google, Meta, etc.) through a single API:

```typescript
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'conversational',
  provider: openrouter,
  model: 'google/gemma-4-31b-it',
  providerOptions: {
    provider: {
      zdr: true,  // Zero Data Retention
      only: ['deepinfra'],
    },
  },
});
```

> **Note:**
>
> **No pricing required:** OpenRouter models automatically fetch pricing data from the OpenRouter API at runtime. You do not need to specify `inputPrice` or `outputPrice` for OpenRouter models.

**Model ID format:** `provider/model-name`

**Example models:**

- `nvidia/nemotron-3-ultra-550b-a55b`
- `google/gemma-4-31b-it`
- `minimax/minimax-m3`
- `meta-llama/llama-3.3-70b-instruct`

**API Key:** Set `OPENROUTER_API_KEY` environment variable

**Package:** `@standardagents/openrouter`

### xAI

xAI uses the official `@ai-sdk/xai` provider for Grok chat and image models:

```typescript
import { defineModel } from '@standardagents/spec';
import { xai } from '@standardagents/xai';

export default defineModel({
  name: 'grok-default',
  provider: xai,
  model: 'grok-4-0709',
  providerOptions: {
    reasoningEffort: 'high',
  },
});
```

**API Key:** Set `XAI_API_KEY` environment variable

**Package:** `@standardagents/xai`

## Provider Options

Each provider has typed options that are validated at build time and runtime:

### OpenAI Provider Options

```typescript
providerOptions: {
  service_tier: 'auto', // 'auto', 'default', or 'flex'
  user: 'user-123',
  seed: 42,
  frequency_penalty: 0.5,
  presence_penalty: 0.5,
  logprobs: true,
  top_logprobs: 5,
  store: true,
  metadata: { key: 'value' },
}
```

### OpenRouter Provider Options

```typescript
providerOptions: {
  provider: {
    order: ['deepinfra', 'novita'],
    allow_fallbacks: true,
    zdr: true,
    only: ['deepinfra'],
    ignore: ['chutes'],
    sort: 'price', // 'price', 'throughput', or 'latency'
    max_price: {
      prompt: 1,
      completion: 5,
    },
    quantizations: ['fp8', 'fp4'],
  },
}
```

### Cerebras Provider Options

```typescript
providerOptions: {
  service_tier: 'default', // 'priority', 'default', 'auto', or 'flex'
  reasoning_effort: 'high', // 'none', 'low', 'medium', or 'high'
  clear_thinking: false,
  user: 'user-123',
  seed: 42,
  logprobs: true,
  top_logprobs: 5,
}
```

### Google Provider Options

```typescript
providerOptions: {
  responseModalities: ['TEXT', 'IMAGE'],
  candidateCount: 1,
  cachedContent: 'cachedContents/...',
  thinkingConfig: {
    thinkingBudget: 1024,
  },
  imageConfig: {
    aspectRatio: '1:1',
  },
}
```

### Groq Provider Options

```typescript
providerOptions: {
  reasoning_format: 'parsed',
  reasoning_effort: 'high',
  citation_options: 'enabled',
  service_tier: 'auto',
  search_settings: {
    include_domains: ['example.com'],
  },
}
```

### Cloudflare Provider Options

```typescript
providerOptions: {
  baseUrl: 'https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/ai/v1',
  seed: 42,
  user: 'user-123',
  logprobs: true,
  top_logprobs: 5,
  frequency_penalty: 0.5,
  presence_penalty: 0.5,
}
```

### xAI Provider Options

```typescript
providerOptions: {
  reasoningEffort: 'high',
  logprobs: true,
  topLogprobs: 5,
  aspect_ratio: '16:9',
  quality: 'high',
}
```

For xAI search, enable `web_search` or `x_search` in the model's `providerTools`. Select the enabled names in the prompt's `tools`.

See the [Anthropic](/docs/providers/anthropic), [Baseten](/docs/providers/baseten), [Cloudflare Workers AI](/docs/providers/cloudflare), [Cerebras](/docs/providers/cerebras), [DeepInfra](/docs/providers/deepinfra), [Google](/docs/providers/google), [Groq](/docs/providers/groq), [Novita AI](/docs/providers/novita), [OpenAI](/docs/providers/openai), [OpenRouter](/docs/providers/openrouter), and [xAI](/docs/providers/xai) documentation for complete options.

## Model Capabilities

Set capabilities to help the framework understand what features the model supports:

```typescript
export default defineModel({
  name: 'conversational',
  provider: openrouter,
  model: 'google/gemma-4-31b-it',
  inputPrice: 0.1,
  outputPrice: 0.35,
  capabilities: {
    supportsImages: true,
    supportsToolCalls: true,
    supportsJsonMode: true,
    supportsStreaming: true,
    maxContextTokens: 262144,
    maxOutputTokens: 16384,
  },
});
```

| Capability          | Type                             | Description                                               |
| ------------------- | -------------------------------- | --------------------------------------------------------- |
| `supportsImages`    | `boolean`                        | Model can process image inputs                            |
| `supportsToolCalls` | `boolean`                        | Model supports function/tool calling                      |
| `supportsJsonMode`  | `boolean`                        | Model supports structured JSON output                     |
| `supportsStreaming` | `boolean`                        | Model supports streaming responses                        |
| `maxContextTokens`  | `number`                         | Maximum context window size                               |
| `maxOutputTokens`   | `number`                         | Maximum output tokens                                     |
| `reasoningLevels`   | `Record<number, string \| null>` | Mapping of 0-100 scale to model-specific reasoning levels |

## Provider Tools

Some providers offer built-in tools. Enable the provider-defined tool names on
the model with `providerTools`:

```typescript
import { defineModel } from '@standardagents/spec';
import { openai } from '@standardagents/openai';

export default defineModel({
  name: 'gpt-6.1-sol-with-tools',
  provider: openai,
  model: 'gpt-6.1-sol',
  // Prices change. Check https://developers.openai.com/api/docs/pricing
  // Standard rates apply to prompts up to 272K tokens.
  inputPrice: 2,
  outputPrice: 10,
  providerTools: ['web_search', 'code_interpreter'],
});
```

**OpenAI Provider Tools:**

- `web_search` - Search the web with citations
- `file_search` - Search uploaded files (requires the `vectorStoreId` variable)
- `code_interpreter` - Execute Python code
- `image_generation` - Generate images with an OpenAI image model

**OpenRouter Provider Tools:**

- `web_search` - Search the web through OpenRouter server tools
- `web_fetch` - Fetch and extract URL content through OpenRouter
- `datetime` - Resolve the current date and time through OpenRouter
- `image_generation` - Generate images through OpenRouter server tools

Prompts must also select the enabled provider-tool names in their `tools` arrays.

Provider packages translate these names into their native request format and
execute them through the provider API. Standard Agents Builder discovers and selects the
tools, but does not execute provider tools locally. Completed calls are recorded
through the generic provider-tool log path.

## Fallback Models

Fallback models provide resilience when the primary model is unavailable or fails. The system automatically retries with fallback models for:

- Network errors
- Rate limits (429)
- Server errors (5xx)
- Authentication errors (401)

Fallbacks reference other models you've defined with `defineModel` by their `name`:

```typescript
// agents/models/fallback_cheap.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'fallback-cheap',
  provider: openrouter,
  model: 'nvidia/nemotron-3-super-120b-a12b',
  inputPrice: 0.1,
  outputPrice: 0.5,
});

// agents/models/primary.ts
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

export default defineModel({
  name: 'primary-model',
  provider: openrouter,
  model: 'nvidia/nemotron-3-ultra-550b-a55b',
  fallbacks: ['fallback-cheap'],
  inputPrice: 0.5,
  outputPrice: 2.5,
});
```

### Retry Sequence

Each model gets up to two attempts. Stream timeouts and missing provider credentials skip the same-model retry. A user stop ends the retry chain. Other failures use backoff. A provider's `retryAfter` hint can extend the delay.

For a failure that permits a same-model retry:

1. **Primary model** (attempt 1) → Failed? Retry...
2. **Primary model** (attempt 2) → Failed? Try fallback...
3. **Fallback 1** (attempt 1) → Failed? Retry...
4. **Fallback 1** (attempt 2) → Failed? Try next fallback...
5. **Fallback 2** (attempt 1) → Failed? Retry...
6. **Fallback 2** (attempt 2) → Failed? Throw error

> **Tip:**
>
> Configure fallbacks for production deployments to ensure high availability. Choose fallback models from different providers to avoid provider-specific outages.

## Pricing Configuration

Configure pricing to track token costs across your application:

The open-weight examples use representative token rates from the maintained model guide.
Check the [OpenRouter catalog](https://openrouter.ai/api/v1/models) before setting an override.
Cache writes and tools can add costs.

```typescript
defineModel({
  name: 'tool-reasoning',
  provider: openrouter,
  model: 'nvidia/nemotron-3-ultra-550b-a55b',
  inputPrice: 0.5,
  outputPrice: 2.5,
});
```

**Pricing units:** All prices are in USD per 1 million tokens

### Live pricing

Use the provider's pricing page for current rates: [OpenAI](https://developers.openai.com/api/docs/pricing), [Anthropic](https://platform.claude.com/docs/en/about-claude/pricing), [Google](https://ai.google.dev/gemini-api/docs/pricing), [Cerebras](https://www.cerebras.ai/pricing), or [Cloudflare Workers AI](https://developers.cloudflare.com/workers-ai/platform/pricing/).

OpenRouter rates come from its [live model catalog](https://openrouter.ai/api/v1/models). OpenRouter models fetch those rates at runtime.

For platform requests, check the recent requests in **Settings → Billing**. The request cost includes the router fee.

## Type Safety

After you define models, Standard Agents populates `StandardAgentSpec.ModelRegistry`. `StandardAgentSpec.Models` resolves to its registered names:

```typescript
// Auto-generated
declare global {
  namespace StandardAgentSpec {
    interface ModelRegistry {
      'tool-reasoning': true;
      conversational: true;
      'code-generation': true;
    }
  }
}
export {};
```

This enables type-safe model references in prompts:

```typescript
definePrompt({
  name: 'my_prompt',
  model: 'tool-reasoning',  // TypeScript validates this
  // model: 'typo',  // ❌ Error: not a valid model
  // ...
});
```

## Common Patterns

### Cost-Optimized Chain

Use cheaper models with expensive fallbacks:

```typescript
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';

defineModel({
  name: 'budget-primary',
  provider: openrouter,
  model: 'z-ai/glm-4.7-flash',
  fallbacks: ['conversational', 'tool-reasoning'],
  inputPrice: 0.06,
  outputPrice: 0.4,
});
```

### Multi-Provider Resilience

Fallbacks across providers for maximum uptime:

```typescript
import { defineModel } from '@standardagents/spec';
import { openrouter } from '@standardagents/openrouter';
import { deepinfra } from '@standardagents/deepinfra';

// Primary model through OpenRouter.
defineModel({
  name: 'resilient-model',
  provider: openrouter,
  model: 'google/gemma-4-31b-it',
  fallbacks: ['deepinfra-chat'],
});

// The same open-weight model through a separate provider API.
defineModel({
  name: 'deepinfra-chat',
  provider: deepinfra,
  model: 'google/gemma-4-31B-it',
});
```

## Environment Setup

Configure provider API keys as environment variables.
Use `.dev.vars` for local development and your project's environment settings on the Standard Agents platform for a deployed project.
A project linked to the Standard Agents platform can use `STANDARD_AGENTS_API_KEY` in place of keys for Standard Agents provider packages.
A request that uses the platform key costs what the Standard Agents router charged for it, router fee included.
Request logs and thread cost totals show that charge in local development and in deployed projects, and include failed and retried attempts the router charged.
An amount marked "\~" is an estimate; the router reports the final charge within about an hour.
Model prices such as `inputPrice` apply to requests that use your own provider key.
A provider from `defineProvider` needs its own required variables.

A model whose provider has no key fails its run.
The thread transcript names the variable to set and where to set it.
For other failures the transcript shows the failure class, and the request log holds the full error.
The Providers page marks the provider "Not configured".

```bash .dev.vars
# Cloudflare Workers AI
CLOUDFLARE_API_TOKEN=...
CLOUDFLARE_ACCOUNT_ID=...

# Cerebras
CEREBRAS_API_KEY=...

# DeepInfra
DEEPINFRA_API_KEY=...

# Google
GOOGLE_API_KEY=...

# Groq
GROQ_API_KEY=...

# Novita AI
NOVITA_API_KEY=...

# Baseten Model APIs
BASETEN_API_KEY=...

# OpenAI (direct)
OPENAI_API_KEY=sk-...

# Anthropic
ANTHROPIC_API_KEY=sk-ant-...

# OpenRouter (access to multiple providers)
OPENROUTER_API_KEY=sk-or-...

# xAI
XAI_API_KEY=...

# User-defined OpenAI-compatible provider
DARKBLOOM_API_KEY=...
# DARKBLOOM_BASE_URL=https://api.darkbloom.dev/v1
```

For a deployed project, configure production provider keys in your project's
environment settings on the Standard Agents platform.

## File Organization

Models are auto-discovered from the `agents/models/` directory:

```
agents/
└── models/
    ├── heavy_thinking.ts   # export default defineModel({...})
    ├── fast_response.ts    # export default defineModel({...})
    └── budget.ts           # export default defineModel({...})
```

**Requirements:**

- Use snake_case for file names: `heavy_thinking.ts`, `fast_response.ts`
- One model per file
- Default export required

## Next Steps

- [Model API Reference](/docs/api-reference/define/model)

  Complete defineModel specification

* [Baseten Provider](/docs/providers/baseten)

  Baseten Model APIs

- [Cloudflare Provider](/docs/providers/cloudflare)

  Workers AI chat completions

* [Cerebras Provider](/docs/providers/cerebras)

  OpenAI-compatible chat completions

- [DeepInfra Provider](/docs/providers/deepinfra)

  Live catalog of OpenAI-compatible chat models

* [Google Provider](/docs/providers/google)

  Gemini and Imagen

- [Groq Provider](/docs/providers/groq)

  Groq chat completions

* [Novita Provider](/docs/providers/novita)

  OpenAI-compatible Novita models

- [OpenAI Provider](/docs/providers/openai)

  OpenAI-specific configuration

* [OpenRouter Provider](/docs/providers/openrouter)

  Multi-provider gateway

- [xAI Provider](/docs/providers/xai)

  Grok chat and image models

* [Prompts](/docs/core-concepts/prompts)

  Learn how to use models in prompts
