Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/manusapis/Agix/llms.txt

Use this file to discover all available pages before exploring further.

Agix’s OpenAI integration sends every chat request to OpenAI’s /chat/completions REST endpoint using a standard Bearer token for authentication. The same OpenAIProvider class also powers the OpenRouter and Custom Endpoint options, because all three share the same OpenAI-compatible API surface. Once you enter your API key in the sidebar and save, your chosen model is ready to answer questions about your spreadsheet data.

Default configuration

The default configuration registered in providers.config.ts is:
{
  id: "openai",
  name: "OpenAI",
  apiKey: "",                          // Supplied at runtime in the sidebar
  baseUrl: "https://api.openai.com/v1",
  defaultModel: "gpt-4o-mini",
  enabled: true,
}
gpt-4o-mini is the default because it offers a strong balance of speed and cost for the everyday spreadsheet tasks Agix handles. You can type a different model name into the Model field at any time without changing any default configuration.

Setting up OpenAI in the sidebar

1

Open the Agix sidebar

In Excel, click Home → Agix. In Google Sheets, open the Agix add-on from the Extensions menu.
2

Select the OpenAI provider

In the Provider dropdown, choose OpenAI.
3

Enter your API key

Paste your sk-... key into the API Key field. Keys are stored in the Office document settings and never leave your device in plaintext.
4

Choose a model (optional)

The default model is gpt-4o-mini. Change it to gpt-4o or any other model name supported by your account.
5

Save

Click Save. Agix calls settingsStore.save() and your configuration persists for the current document.

AIProviderConfig shape for OpenAI

{
  id: "openai",
  name: "OpenAI",
  apiKey: "sk-...",
  baseUrl: "https://api.openai.com/v1",
  defaultModel: "gpt-4o-mini",
  enabled: true
}

Request parameters

OpenAIProvider.chat() forwards the following fields to the /chat/completions endpoint:
model
string
required
The model to use, e.g. gpt-4o-mini or gpt-4o. Taken from the ChatRequest.
messages
ChatMessage[]
required
The full conversation history, including any system, user, and assistant turns.
temperature
number
default:"0.7"
Controls response randomness. Agix uses 0.7 when the caller does not supply a value.
max_tokens
number
Maximum tokens in the response. Omitted from the request when not specified, which lets OpenAI use its own default.
stream
boolean
default:"false"
Always set to false — Agix uses non-streaming responses.

Response shape

A successful call returns a ChatResponse:
interface ChatResponse {
  provider: "openai";
  model: string;
  content: string;          // Text of the first choice
  finishReason?: string;    // e.g. "stop", "length"
  usage?: {
    promptTokens: number;
    completionTokens: number;
    totalTokens: number;
  };
}
Token usage is mapped from the OpenAI usage object (prompt_tokens, completion_tokens, total_tokens).

Shared implementation with OpenRouter

OpenAI and OpenRouter both resolve to the same OpenAIProvider class in the factory:
case "openai":
case "openrouter":
case "custom":
  return new OpenAIProvider(config);
The only difference between them is the baseUrl and the model naming convention. This means any fix or improvement to OpenAIProvider applies to all three provider IDs automatically.
Use gpt-4o for complex multi-step analysis, formula generation, or tasks where accuracy matters most. Switch to gpt-4o-mini for quick data lookups, cell summaries, and high-volume operations where speed and cost efficiency are the priority.

Build docs developers (and LLMs) love