Providers
aioc executes runs through a default provider.
High-level Setup Helpers
Section titled “High-level Setup Helpers”The simplest options are:
setupMistral(options?)setupOpenAI(options?)setupProvider("mistral", options?)setupProvider("openai", options?)These helpers:
- resolve the API key from arguments or environment
- create the provider instance
- register it as the runtime default provider
API Key Resolution
Section titled “API Key Resolution”Current environment variable names:
MISTRAL_API_KEYOPENAI_API_KEY
If the key is missing both in arguments and in the environment, setup throws.
Minimal Example
Section titled “Minimal Example”import "dotenv/config";import { setupMistral } from "@axiastudio/aioc";
setupMistral();Chat Completions Model Settings
Section titled “Chat Completions Model Settings”Chat Completions providers forward supported Agent.modelSettings fields. For
JSON mode, configure response_format on the agent:
const agent = new Agent({ name: "JSON Agent", model: "gpt-4.1-mini", instructions: "Return a JSON object.", modelSettings: { response_format: { type: "json_object" }, },});response_format is optional and forwarded unchanged, including
{ type: "json_schema", json_schema: ... }. The selected backend and model
must support the requested format. aioc does not parse or repair the returned
JSON.
Instruction Role Mapping
Section titled “Instruction Role Mapping”Agent.instructions is provider-neutral at the runtime level.
The wire role used for those instructions depends on the provider integration:
OpenAIProvidersends resolved agent instructions as adevelopermessageMistralProvidersends resolved agent instructions as asystemmessage- the shared
ChatCompletionsProviderbase defaults tosystem
This mapping only affects how the provider request is serialized. It does not change the public Agent contract.
Low-level Setup
Section titled “Low-level Setup”For custom providers, the low-level route is:
setDefaultProvider(provider)The provider must implement:
interface ModelProvider { stream<TContext = unknown>( request: ProviderRequest<TContext>, ): AsyncIterable<ProviderEvent>;}When To Use The Low-level Route
Section titled “When To Use The Low-level Route”Use setDefaultProvider(...) when:
- you are integrating a provider not shipped with
aioc - you want a custom stub or scripted provider
- you want to test runtime behavior without a live model
For normal usage, prefer setupMistral(...) or setupOpenAI(...).