IntelligenceX

API Reference

Class

IntelligenceXClient

Namespace IntelligenceX.OpenAI
Assembly IntelligenceX
Implements
IDisposable IAsyncDisposable
Modifiers sealed

Main client for OpenAI app-server and native transports.

Inheritance

  • Object
  • IntelligenceXClient

Usage

Explore 9 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Methods

ChatAsync 2 overloads
public async Task<TurnInfo> ChatAsync(String text, String? model = null, CancellationToken cancellationToken = default) #
Returns: Task<TurnInfo>

Sends a text-only chat request.

Parameters

text System.String requiredposition: 0
Prompt text.
model System.String? = null optionalposition: 1
Optional model override.
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
Cancellation token.

Returns

A task that resolves to TurnInfo.

public async Task<TurnInfo> ChatAsync(ChatInput input, ChatOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Task<TurnInfo>

Sends a chat request with a structured input.

Parameters

input IntelligenceX.OpenAI.Chat.ChatInput requiredposition: 0
Chat input.
options IntelligenceX.OpenAI.Chat.ChatOptions? = null optionalposition: 1
Chat options.
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
Cancellation token.

Returns

A task that resolves to TurnInfo.

public async Task<TurnInfo> ChatWithImagePathAsync(String text, String imagePath, ChatOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Task<TurnInfo>

Sends a chat request with a local image.

Parameters

text System.String requiredposition: 0
Prompt text.
imagePath System.String requiredposition: 1
Local image path.
options IntelligenceX.OpenAI.Chat.ChatOptions? = null optionalposition: 2
Chat options.
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
Cancellation token.

Returns

A task that resolves to TurnInfo.

public async Task<TurnInfo> ChatWithImageUrlAsync(String text, String imageUrl, ChatOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Task<TurnInfo>

Sends a chat request with an image URL.

Parameters

text System.String requiredposition: 0
Prompt text.
imageUrl System.String requiredposition: 1
Image URL.
options IntelligenceX.OpenAI.Chat.ChatOptions? = null optionalposition: 2
Chat options.
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
Cancellation token.

Returns

A task that resolves to TurnInfo.

public IntelligenceXClient ConfigureDefaults(String? model = null, String? workingDirectory = null, String? approvalPolicy = null, SandboxPolicy? sandboxPolicy = null) #
Returns: IntelligenceXClient

Configures default model and execution settings.

Parameters

model System.String? = null optionalposition: 0
Default model override.
workingDirectory System.String? = null optionalposition: 1
Default working directory.
approvalPolicy System.String? = null optionalposition: 2
Default approval policy.
sandboxPolicy IntelligenceX.OpenAI.AppServer.SandboxPolicy? = null optionalposition: 3
Default sandbox policy.

Returns

The current client instance.

public IntelligenceXClient ConfigureWorkspace(String workingDirectory, Boolean allowNetwork = false) #
Returns: IntelligenceXClient

Configures defaults for workspace-based tool access.

Parameters

workingDirectory System.String requiredposition: 0
Workspace path.
allowNetwork System.Boolean = false optionalposition: 1
Whether network access is allowed.

Returns

The current client instance.

public static async Task<IntelligenceXClient> ConnectAsync(IntelligenceXClientOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Task<IntelligenceXClient>

Connects to the configured transport and returns a ready client.

Parameters

options IntelligenceX.OpenAI.IntelligenceXClientOptions? = null optionalposition: 0
Optional client options.
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
Cancellation token.

Returns

A task that resolves to IntelligenceXClient.

public Void Dispose() #
Returns: Void

Disposes the client and underlying transport.

public ValueTask DisposeAsync() #
Returns: ValueTask

Disposes the client and underlying transport asynchronously.

Returns

A value task that completes when the operation finishes.

public async Task EnsureChatGptLoginAsync(Boolean forceLogin = false, Action<String>? onUrl = null, Func<String, Task<String>>? onPrompt = null, Boolean useLocalListener = true, TimeSpan? timeout = null, CancellationToken cancellationToken = default) #
Returns: Task

Ensures a valid ChatGPT login is available by using cached credentials when possible and falling back to the OAuth flow.

Parameters

forceLogin System.Boolean = false optionalposition: 0
When true, always runs the login flow even if cached credentials appear valid.
onUrl System.Action<System.String>? = null optionalposition: 1
Callback for the login URL.
onPrompt System.Func<System.String, System.Threading.Tasks.Task<System.String>>? = null optionalposition: 2
Callback for interactive prompts.
useLocalListener System.Boolean = true optionalposition: 3
Whether to use a local listener.
timeout System.TimeSpan? = null optionalposition: 4
Optional timeout.
cancellationToken System.Threading.CancellationToken = default optionalposition: 5
Cancellation token.

Returns

A task that completes when the operation finishes.

public Task<AccountInfo> GetAccountAsync(CancellationToken cancellationToken = default) #
Returns: Task<AccountInfo>

Retrieves account information.

Parameters

cancellationToken System.Threading.CancellationToken = default optionalposition: 0
Cancellation token.

Returns

A task that resolves to AccountInfo.

public Task<HealthCheckResult> HealthCheckAsync(String? method = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default) #
Returns: Task<HealthCheckResult>

Executes a health check call.

Parameters

method System.String? = null optionalposition: 0
Optional method name to call.
timeout System.TimeSpan? = null optionalposition: 1
Optional timeout.
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
Cancellation token.

Returns

A task that resolves to HealthCheckResult.

public Task InitializeAsync(ClientInfo clientInfo, CancellationToken cancellationToken = default) #
Returns: Task

Initializes the transport with client metadata.

Parameters

clientInfo IntelligenceX.OpenAI.AppServer.ClientInfo requiredposition: 0
Client identity information.
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
Cancellation token.

Returns

A task that completes when the operation finishes.

public Task<ModelListResult> ListModelsAsync(CancellationToken cancellationToken = default) #
Returns: Task<ModelListResult>

Lists available models.

Parameters

cancellationToken System.Threading.CancellationToken = default optionalposition: 0
Cancellation token.

Returns

A task that resolves to ModelListResult.

public Task LoginApiKeyAsync(String apiKey, CancellationToken cancellationToken = default) #
Returns: Task

Logs in using an API key (app-server transport only).

Parameters

apiKey System.String requiredposition: 0
API key.
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
Cancellation token.

Returns

A task that completes when the operation finishes.

public async Task LoginChatGptAndWaitAsync(Action<String>? onUrl = null, Func<String, Task<String>>? onPrompt = null, Boolean useLocalListener = true, TimeSpan? timeout = null, CancellationToken cancellationToken = default) #
Returns: Task

Starts a ChatGPT login flow and waits for completion.

Parameters

onUrl System.Action<System.String>? = null optionalposition: 0
Callback for the login URL.
onPrompt System.Func<System.String, System.Threading.Tasks.Task<System.String>>? = null optionalposition: 1
Callback for interactive prompts.
useLocalListener System.Boolean = true optionalposition: 2
Whether to use a local listener.
timeout System.TimeSpan? = null optionalposition: 3
Optional timeout.
cancellationToken System.Threading.CancellationToken = default optionalposition: 4
Cancellation token.

Returns

A task that completes when the operation finishes.

LoginChatGptAsync 2 overloads
public Task<ChatGptLoginStart> LoginChatGptAsync(CancellationToken cancellationToken = default) #
Returns: Task<ChatGptLoginStart>

Starts a ChatGPT login flow.

Parameters

cancellationToken System.Threading.CancellationToken = default optionalposition: 0
Cancellation token.

Returns

A task that resolves to ChatGptLoginStart.

public Task<ChatGptLoginStart> LoginChatGptAsync(Action<String>? onUrl, Func<String, Task<String>>? onPrompt, Boolean useLocalListener = true, TimeSpan? timeout = null, CancellationToken cancellationToken = default) #
Returns: Task<ChatGptLoginStart>

Starts a ChatGPT login flow with callbacks and options.

Parameters

onUrl System.Action<System.String>? requiredposition: 0
Callback for the login URL.
onPrompt System.Func<System.String, System.Threading.Tasks.Task<System.String>>? requiredposition: 1
Callback for interactive prompts.
useLocalListener System.Boolean = true optionalposition: 2
Whether to use a local listener.
timeout System.TimeSpan? = null optionalposition: 3
Optional timeout.
cancellationToken System.Threading.CancellationToken = default optionalposition: 4
Cancellation token.

Returns

A task that resolves to ChatGptLoginStart.

public Task<AccountInfo> LoginCopilotAsync(Action<GitHubDeviceAuthorization> onCode, CancellationToken cancellationToken = default) #
Returns: Task<AccountInfo>

Signs in to native Copilot through the host's registered GitHub app, without launching a CLI.

Parameters

onCode System.Action<IntelligenceX.Authentication.GitHub.GitHubDeviceAuthorization> requiredposition: 0
Displays the verification URL and user code. The application decides how to present them.
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
Cancels sign-in and polling.

Returns

The verified GitHub account associated with the new credential.

public Task LogoutAsync(CancellationToken cancellationToken = default) #
Returns: Task

Logs out of the current session.

Parameters

cancellationToken System.Threading.CancellationToken = default optionalposition: 0
Cancellation token.

Returns

A task that completes when the operation finishes.

public AppServerClient RequireAppServer() #
Returns: AppServerClient

Returns the underlying app-server client or throws if not active.

Returns

The resulting AppServerClient.

public async Task<ThreadInfo> StartNewThreadAsync(String? model = null, String? currentDirectory = null, String? approvalPolicy = null, String? sandbox = null, CancellationToken cancellationToken = default) #
Returns: Task<ThreadInfo>

Starts a new thread and sets it as the current thread.

Parameters

model System.String? = null optionalposition: 0
Optional model override.
currentDirectory System.String? = null optionalposition: 1
Optional working directory.
approvalPolicy System.String? = null optionalposition: 2
Optional approval policy.
sandbox System.String? = null optionalposition: 3
Optional sandbox policy name.
cancellationToken System.Threading.CancellationToken = default optionalposition: 4
Cancellation token.

Returns

A task that resolves to ThreadInfo.

public IDisposable SubscribeDelta(Action<String> onDelta) #
Returns: IDisposable

Subscribes to streaming text deltas.

Parameters

onDelta System.Action<System.String> requiredposition: 0
Callback invoked for each delta.

Returns

A subscription token that should be disposed to unsubscribe.

public async Task<ThreadInfo> UseThreadAsync(String threadId, CancellationToken cancellationToken = default) #
Returns: Task<ThreadInfo>

Resumes an existing thread and sets it as the current thread.

Parameters

threadId System.String requiredposition: 0
Thread id.
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
Cancellation token.

Returns

A task that resolves to ThreadInfo.

Properties

public OpenAITransportKind TransportKind { get; } #

Gets the active transport kind.

public AppServerClient RawClient { get; } #

Gets the underlying app-server client when using app-server transport.

Events

public event EventHandler<String>? DeltaReceived #

Raised when streaming deltas are received.

public event EventHandler<RpcCallStartedEventArgs>? RpcCallStarted #

Raised when an RPC call starts.

public event EventHandler<RpcCallCompletedEventArgs>? RpcCallCompleted #

Raised when an RPC call completes.

public event EventHandler<IntelligenceXTurnCompletedEventArgs>? TurnCompleted #

Raised when a chat turn completes, including optional usage metadata.

public event EventHandler<LoginEventArgs>? LoginStarted #

Raised when a login flow starts.

public event EventHandler<LoginEventArgs>? LoginCompleted #

Raised when a login flow completes.

public event EventHandler<String>? ProtocolLineReceived #

Raised when a protocol line is received from the transport.

public event EventHandler<String>? StandardErrorReceived #

Raised when the transport writes to standard error.