Chat interface
The chat interface is suitable for scenarios such as dialogue, Q&A, code generation, and tool invocation. Most OpenAI compatible SDKs can be plugged in directly.
Path
POST /v1/chat/completions
Base URL Please log in to the official website and view and copy it on the User Center - [API Key] page.
Example
BASE_URL="The Base URL copied from the official website User Center - [API Key] page"
curl "$BASE_URL/chat/completions" \
-H "Authorization: Bearer YOUR_MUSKAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Introducing MuskAI"}]}'
Common parameters
- model: model name.
- messages: array of conversation messages.
- temperature: sampling temperature.
- stream: whether to use streaming output.