Overview
Chat completions allow you to generate human-like text responses using state-of-the-art language models. CyrionAI provides access to multiple models including GPT-4, Claude-3, and others through a unified API.Basic Usage
Simple Chat Completion
Multi-turn Conversation
Message Roles
System Message
Sets the behavior and context for the conversation:User Message
Represents input from the user:Assistant Message
Represents responses from the AI model:Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
model | string | The model to use (e.g., “gpt-4o-mini”, “claude-3-sonnet”) |
messages | array | Array of message objects with role and content |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
max_tokens | integer | null | Maximum number of tokens to generate |
temperature | number | 1.0 | Controls randomness (0-2) |
top_p | number | 1.0 | Controls diversity via nucleus sampling (0-1) |
n | integer | 1 | Number of completions to generate |
stop | string/array | null | Stop sequences |
presence_penalty | number | 0.0 | Penalty for new topics (-2 to 2) |
frequency_penalty | number | 0.0 | Penalty for repetition (-2 to 2) |
user | string | null | User identifier for tracking |
Temperature
Controls the randomness of the output:Max Tokens
Limit the length of the response:Supported Models
GPT Models
| Model | Description | Best For |
|---|---|---|
gpt-4o-mini | Fast and efficient | General tasks, quick responses |
gpt-4o | Most capable | Complex reasoning, creative writing |
gpt-3.5-turbo | Legacy model | Simple tasks, cost-effective |
Claude Models
| Model | Description | Best For |
|---|---|---|
claude-3-haiku | Fast and efficient | Quick responses, simple tasks |
claude-3-sonnet | Balanced performance | General purpose, good reasoning |
claude-3-opus | Most capable | Complex analysis, creative writing |
Other Models
| Model | Description | Best For |
|---|---|---|
llama-3-8b | Open source | Custom applications, fine-tuning |
llama-3-70b | Large open source | Complex reasoning, research |
Advanced Features
Function Calling
Web Search
Enable web search for up-to-date information:Image Understanding
Include images in your conversations:Best Practices
1. Use System Messages Effectively
2. Manage Conversation Context
3. Use Appropriate Temperature
4. Handle Long Conversations
Error Handling
Response Format
Examples
Grant Writing Assistant
Donor Communication
Program Evaluation
Next Steps
- Learn about image generation
- Explore video generation
- Check out more chat examples
- View the API reference