AIX. - Grok / X - API

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIX. - Grok / X - API > !Model and Endpoint Configuration >

AIX. - Grok / X - API

AIX.SetModel

Previous Top Next


MiniRobotLanguage (MRL)

 

AIX.Set Model
Set the AI Model to be Used

 

Intention

 

SetModel Command: Selecting the AI Model
 
The Set Model command allows you to specify the AI model used by Grok for generating responses, stored in the AIX_Model global variable. This enables customization based on the task’s complexity, performance needs, or cost considerations. It’s part of the AIX - Grok / X - API suite.

 

What is the SetModel Command?

 

The Set Model command sets the AIX_Model global variable to a specific model identifier supported by xAI’s Grok platform. Available models as of March 18, 2025, include:

**grok-1**: Released in 2023, a general-purpose model optimized for basic queries, priced at approximately $0.0001 per token.

**grok-2**: Released in 2024, an enhanced version with improved reasoning and language understanding, priced at about $0.00015 per token.

**grok-3**: The latest model released in 2025, offering state-of-the-art features for complex tasks, priced at $0.0002 per token, with volume discounts available for high usage.

If an invalid model name is provided, it defaults to "grok-1". Pricing is based on xAI’s per-token model and may vary with usage volume or subscription plans; consult https://x.ai/pricing for the latest rates.

 

Why Do You Need It?

 

Setting the model is crucial for:

Performance: Choose a model suited to the task’s computational demands, such as "grok-3" for complex applications.

Cost Management: Opt for cost-effective models like "grok-1" at $0.0001 per token for large-scale use.

Quality: Use "grok-3" for high-stakes queries, leveraging its $0.0002 per token rate with potential discounts.

 

How to Use the SetModel Command?

 

Provide a valid model name (e.g., "grok-3") to set the AIX_Model variable, which is then used for all subsequent API calls.

Verify the current model with AIX.Get Model. For the latest model list, pricing updates, and volume discount details, refer to https://x.ai/pricing and https://x.ai/docs.

 

Example Usage

 

AIX.Set Model|"grok-3"

AIX.Ask|Solve a complex math problem|0

DBP.Solution: $$AIX_GrokContent

 

Uses the "grok-3" model for a high-accuracy response, costing approximately $0.0002 per token, with potential volume discounts for high usage.

 

AIX.Set Model|"grok-1"

AIX.Ask|Generate a simple greeting|0

DBP.Greeting: $$AIX_GrokContent

 

Switches to "grok-1" for a cost-effective, general-purpose response at $0.0001 per token.

 

Illustration

 

┌───────────────┐

│ Current Model │

├───────────────┤

│ "grok-3"      │

└───────────────┘

Setting the model to grok-3 for advanced tasks, at $0.0002 per token with volume discounts.

 

Syntax

 

AIX.SetModel[|P1]

AIX.Set Model[|P1]

 

Parameter Explanation

 

P1 - (Optional) A string specifying the model name (e.g., "grok-1", "grok-2", "grok-3"). Invalid names default to "grok-1".

 

Example

 

AIX.Set Model|"grok-3"

AIX.Ask|Analyze a scientific paper|0

DBP.Analysis: $$AIX_GrokContent

ENR.

 

Remarks

 

- Applies to AIX.Ask and AIX.Ask Vision.

- Model availability, pricing, and volume discounts are subject to xAI’s API updates; consult https://x.ai/pricing and https://x.ai/docs for the latest details.

 

Limitations

 

- Only supported models ("grok-1", "grok-2", "grok-3") can be set; unrecognized names revert to "grok-1".

- Costs accrue based on token usage; monitor via xAI’s API dashboard, especially for "grok-3" with its higher base price but potential volume discounts.

 

See also:

 

AIX.Get Model

AIX.Ask

AIX.Set Temperature

AIX.Get Content