Overview
Chat completions are the primary interface for text generation and conversational AI. Use the OpenAI-compatible API to access language models from leading providers.Quick Start
Using the OpenAI Python SDK
Core Concepts
Messages
Messages are organized by role:system: Instructions for the assistant’s behavioruser: User inputs and queriesassistant: Previous assistant responses
Parameters
- model: The model to use (e.g.,
moonshotai/kimi-k2-0905) - messages: Array of message objects
- temperature: Randomness (0-2, default 1)
- max_tokens: Maximum response length
- stream: Return streaming response