For the complete documentation index, see llms.txt. This page is also available as Markdown.

Overview

An overview of InteractiveAI's API

The InteractiveAI Router provides a unified API for accessing language models across multiple providers. Request and response schemas follow the OpenAI Chat API specification with targeted enhancements, allowing operators to work with a single interface regardless of the underlying model or provider.

Requests

Basic Request Example

fetch('https://app.interactive.ai/api/v1/chat/completions', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <LLMROUTER_API_KEY>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'anthropic/claude-3-sonnet',
    messages: [
      {
        role: 'user',
        content: 'Summarize the key risks in this quarterly financial report.',
      },
    ],
  }),
});

Request Format

Submit completion requests as POST request to the /api/v1/chat/completions endpoint. The request body accepts the following schema:

The response_format parameter enforces structured JSON output. This is supported by OpenAI models, Nitro models, and select others. Verify provider support on the models page and set require_parameters to true in your Provider Preferences.

For the complete parameter reference, see Parameters.

Model Selection

When the model parameter is omitted, the Router uses the default configured for your account. When specified, include the provider prefix (e.g., anthropic/claude-3-sonnet, mistral/mistral-large).

The Router automatically selects optimal infrastructure for each request and falls back to alternative providers when the primary returns a 5xx error or rate limits the request.

Streaming

Server-Sent Events (SSE) are supported across all models. Set stream: true in your request body to receive incremental responses. See Streaming for implementation details.

Parameter Handling

If a model does not support a specific parameter (such as logit_bias for non-OpenAI models or top_k for OpenAI), the Router ignores that parameter and forwards the rest to the underlying provider.

Assistant Prefill

Guide model responses by including a partial assistant message at the end of your messages array. The model will continue from where the prefill ends.

Responses

CompletionsResponse Format

All responses follow a normalized schema regardless of the underlying model or provider. The choices array is always present, even for single-completion responses.

Here is the response schema as a TypeScript type:

Here's an example:

Finish Reason

The Router normalizes finish_reason across all models to one of five values:

Value
Description

stop

Natural completion

length

Token limit reached

tool_calls

Model invoked a tool

content_filter

Content filtered by provider

error

Error during generation

Access the provider's original finish reason through native_finish_reason when debugging provider-specific behavior.

Last updated

Was this helpful?