# Ruma Agent chat completions

- Method: `POST`
- Path: `/chat/completions`
- Tier: Pro
- HTML docs: https://docs.ruma.fun/reference/post-chat-completions/
- Interactive docs: https://docs.ruma.fun/#endpoint=post-chat-completions

## Description

Stateless Ruma Agent inference over Ruma's market intelligence layer. Pass a messages array; the latest user message is answered and up to six preceding messages are used as caller-managed conversation context. Set stream=true for OpenAI-style SSE text deltas. thinking_mode is optional and defaults to auto; use deep for deeper reasoning.

## cURL Example

```bash
curl --request POST \
  --url 'https://api.ruma.fun/api/v1/public/chat/completions' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "content": "What narratives are heating up around Solana?",
      "role": "user"
    }
  ],
  "stream": true,
  "thinking_mode": "auto"
}'
```

## Path Parameters

No path parameters for this endpoint.

## Query Parameters

No query parameters for this endpoint.

## Request Body

Media type: `application/json`

```json
{
  "messages": [
    {
      "content": "What narratives are heating up around Solana?",
      "role": "user"
    }
  ],
  "stream": true,
  "thinking_mode": "auto"
}
```

## Response

OK. When stream=true, the response is text/event-stream with OpenAI-style chat.completion.chunk data frames.

- `choices` (array<object>): No description provided.
- `choices[].delta` (object): No description provided.
- `choices[].delta.content` (string): No description provided.
- `choices[].delta.role` (string): No description provided.
- `choices[].finish_reason` (string): No description provided.
- `choices[].index` (integer): No description provided.
- `choices[].message` (object): No description provided.
- `choices[].message.content` (string): No description provided.
- `choices[].message.role` (string): No description provided.
- `created` (integer (int64)): No description provided.
- `id` (string): No description provided.
- `model` (string): No description provided.
- `object` (string): No description provided.
- `usage` (object): No description provided.
- `usage.credits_used` (integer (int64)): No description provided.

Media type: `application/json`

## JSON Response

```json
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Solana attention is being driven by renewed DEX volume, app-token speculation, and smart-money accumulation in adjacent ecosystem names.",
        "role": "assistant"
      }
    }
  ],
  "created": 1780934400,
  "id": "chatcmpl_example",
  "model": "ruma-agent",
  "object": "chat.completion",
  "usage": {
    "credits_used": 42
  }
}
```
