# Chat Completions API

Send an OpenAI-compatible messages payload to `/v1/chat/completions` using a model identifier returned by `/v1/models`.

```bash
curl https://api.foxora.ai/v1/chat/completions \
  -H "Authorization: Bearer $FOXORA_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<model-id-from-v1-models>",
    "messages": [
      {"role": "user", "content": "Summarize this in three bullets."}
    ]
  }'
```

1. Fetch the current model list instead of hardcoding a provider model.
2. Send ordered `messages` with a non-empty `model`.
3. Read the assistant result from `choices` and the metering details from `usage`.
4. Preserve `x-request-id` when a request fails.

Set `stream: true` only when the client can consume server-sent events and handle a stream that ends early.

**Expected result:** HTTP success returns an assistant choice plus usage data for the completed request.
