Skip to main content
POST
Chat Completions
Generate agent responses with Stratus planning and LLM execution.

Endpoint

Request Format

Stratus follows the OpenAI Chat Completions API format:

Example Request

Python

cURL

Response Format

Example Response

State and Goal Convention

Stratus works best when you structure messages as: System message = Current State Describe where the agent currently is.
User message = Goal Describe what the agent should achieve.
This convention helps Stratus:
  • Encode current state accurately
  • Plan toward the goal
  • Predict state transitions

Parameters

model (required)

Combined Stratus + LLM model name. Native format: stratus-x1ac-{size}-{llm} OpenRouter format: stratus-x1ac-{size}-{or-provider}/{or-model}
See Models for the complete list of 2,050+ combinations.

messages (required)

Array of conversation messages.
Best Practice:
  • Use system for state/context
  • Use user for goals/instructions
  • Include assistant for multi-turn conversations

temperature (optional)

Controls randomness in LLM execution (not planning).
  • Range: 0-2
  • Default: 1.0
  • Lower = more deterministic
  • Higher = more creative
Note: Stratus planning is deterministic. Temperature only affects LLM execution.

max_tokens (optional)

Maximum tokens in completion.

top_p (optional)

Nucleus sampling parameter.
  • Range: 0-1
  • Default: 1.0

stream (optional)

Stream response chunks (SSE format).
Example:

stop (optional)

Stop sequences to end generation.

n (optional)

Number of completions to generate for each prompt.
  • Range: 1 or higher
  • Default: 1
Generating multiple completions (n > 1) increases token usage and latency proportionally. Use sparingly.

presence_penalty (optional)

Penalizes tokens based on whether they appear in the text so far.
  • Range: -2.0 to 2.0
  • Default: 0.0
  • Positive values reduce repetition
  • Negative values encourage repetition

frequency_penalty (optional)

Penalizes tokens based on their frequency in the text so far.
  • Range: -2.0 to 2.0
  • Default: 0.0
  • Positive values reduce repetition of common phrases
  • Negative values encourage reuse of phrases

user (optional)

Unique identifier for the end-user, used for tracking and monitoring.
The user parameter helps with abuse detection and per-user analytics. Recommended for production applications.

tools (optional)

Array of tool (function) definitions for function calling. Maximum 100 tools per request.
See Tools & Function Calling for complete documentation.

tool_choice (optional)

Controls which tool (if any) is called by the model.
  • 'none' - Don’t call any tools
  • 'auto' - Model decides (default)
  • 'required' - Model must call a tool
  • {type: 'function', function: {name: 'tool_name'}} - Force specific tool
See Tools & Function Calling for examples.

Tools & Function Calling

Stratus supports OpenAI-compatible function calling, allowing the model to request tool execution during planning and execution.

Overview

Function calling enables:
  • Structured outputs - Get JSON responses in defined schemas
  • External data access - Fetch real-time information (weather, stock prices, etc.)
  • Action execution - Trigger operations (send email, create ticket, etc.)
  • Multi-step workflows - Chain tool calls to accomplish complex tasks

Defining Tools

Tools are defined using JSON Schema:

Tool Choice Strategies

Control tool selection with the tool_choice parameter:

Auto (Default)

Model decides whether to call a tool:

None

Prevent tool calls:

Required

Force the model to call at least one tool:
Use 'required' when you always want a structured tool call response, ensuring the model doesn’t just respond with text.

Specific Tool

Force a specific tool to be called:

Complete Example

Tool Call Response Format

When a tool is called, the response includes tool_calls:

Handling Tool Results

After executing the tool, send the result back:

Multiple Tools Example

Parallel Tool Calls

The model can call multiple tools in parallel:
Handle all tool calls and return results:

Best Practices

1. Clear Tool Descriptions

2. Validate Tool Arguments

3. Handle Tool Errors Gracefully

4. Limit Tool Count

Maximum 100 tools per request. For better performance, limit to 10-20 most relevant tools.

5. Use Enums for Constrained Values

Streaming with Tools

Tool calls work with streaming:
  • Messages API - Anthropic-format alternative with tools support
  • Models - Available models for function calling

Integration with Agent Frameworks

LangChain

AutoGPT / CrewAI

Error Handling

See Error Reference for details.

Best Practices

1. Structure State and Goal Clearly

Good:
Not Ideal:

2. Use Appropriate Model Size

  • small: Simple navigation, prototyping
  • base: Start here - good balance
  • large: Complex multi-step tasks
  • xl/huge: Research, specialized domains

3. Monitor Planning Confidence

4. Leverage Action Sequence

Next Steps