Skip to main content

AI Providers

UIGraph doesn't ship with a built-in AI model, you bring your own. This keeps you in control of where your questions and architecture data go, and lets you use whichever provider you already have an account with. The Slack bot and gateway read the same AI_PROVIDER_* settings described here.

UIGraph uses the AI SDK, a widely used toolkit that speaks to dozens of AI providers through one common interface. So it can work with almost any provider the AI SDK supports, you just tell it which one to use.

There are five settings involved. Most setups only need three.

SettingRequiredWhat it does
AI_PROVIDER_NPMNoWhich provider to use. Defaults to an OpenAI-compatible endpoint.
AI_PROVIDER_API_URLIf AI_PROVIDER_NPM not providedThe endpoint URL. Needed for the default OpenAI-compatible provider; not needed for a dedicated provider package.
AI_PROVIDER_API_KEYYesYour API key for that provider.
AI_PROVIDER_MODELYesWhich model to use, e.g. gpt-4o or claude-sonnet-5.
AI_PROVIDER_OPTIONSNoExtra provider settings, as JSON. Only for advanced cases.

For the values AI_PROVIDER_NPM accepts, see the list of supported providers.

What UIGraph needs to use a model

A model is only used when all of the following are set:

  • A provider package or an endpoint URL: either AI_PROVIDER_NPM (a provider package like @ai-sdk/openai) or AI_PROVIDER_API_URL (an OpenAI-compatible endpoint). At least one of the two.
  • AI_PROVIDER_MODEL: the model name.
  • AI_PROVIDER_API_KEY: the API key.

If any of those is missing, UIGraph treats the AI as not configured.

Why one of the first two? A provider package already knows its provider's endpoint and sets the API URL internally, so you don't pass a URL separately. The default @ai-sdk/openai-compatible package is generic and has no endpoint of its own, so when you use it you must supply AI_PROVIDER_API_URL. See Examples for concrete configurations with real endpoints.

See Providers for the full list of supported providers and their AI_PROVIDER_NPM values, and Examples for complete, copy-pasteable configurations.

Choosing a model

AI_PROVIDER_MODEL is the name of the specific model you want, and it depends on the provider. Use whatever model name the provider lists in its own documentation (the AI SDK pages linked from Providers spell these out).

A few examples to give you the idea:

ProviderExample AI_PROVIDER_MODELPlatform Models List
OpenAIgpt-4odevelopers.openai.com/api/docs/models/all
Anthropicclaude-sonnet-5platform.claude.com/docs/en/about-claude/models
Googlegemini-2.5-proai.google.dev/gemini-api/docs/models
Groqllama-3.3-70b-versatileconsole.groq.com/docs/models
OpenRoutermoonshotai/kimi-k2-thinkingopenrouter.ai/models

Bigger, more capable models usually give better answers but cost more and respond a little slower. A mid-tier model is a good starting point for most teams.

The options setting

AI_PROVIDER_OPTIONS is for the occasional case where a provider needs extra configuration beyond a key and a URL, for example a custom header, an account or region, or a provider-specific flag.

You give it as a single line of JSON, and UIGraph passes whatever you put there straight to the provider. Most people never need it. When a provider's documentation mentions an extra setting, this is where it goes.

For example, to send a custom header:

AI_PROVIDER_OPTIONS='{"headers":{"X-My-Header":"value"}}'

The value must be valid JSON on one line. Which keys are accepted is entirely up to your chosen provider, check that provider's page linked from Providers.