Skip to content
Documentation
GOCUX / Documentationapi reference

Reference: chat completions

Implement a client for the supported GoCux chat endpoint.

Implement a client for the supported GoCux chat endpoint.

Practical procedure

  1. Send a messages array to POST /v1/chat/completions and include at least one user message. Use gocux-deep as the advertised product alias.
  2. Declare classification in the X-GoCux-Data-Classification header, exactly once. Set max_completion_tokens or the supported bounded output option deliberately.
  3. Handle normal choices, streaming deltas and structured refusal responses as different outcomes. Retain correlation context without leaking credentials.

Call the supported chat contract

Normal web chat and the customer CLI use GoCux Gateway. Provider routing stays inside the service. The model catalog advertises the GoCux route alias gocux-deep, not an upstream provider identity. A compatible chat client supplies its message history and an explicit data-classification header; GoCux applies identity, policy, paid admission and credit reservation before a provider request.

Contract example

Developer examples below describe routes on an authorized, configured GoCux control-plane base URL. They are request shapes or operation references, not claims that a particular public hostname exposes the API. Use the workspace for the corresponding human workflow; availability and permissions depend on the actual deployment.

POST /v1/chat/completions X-GoCux-Data-Classification: public Content-Type: application/json

{
  "model": "gocux-deep",
  "messages": [
    {
      "role": "user",
      "content": "Summarize these supplied public notes."
    }
  ],
  "stream": false,
  "max_completion_tokens": 512
}

Inspect the result

Read the returned choices and handle an error response before showing a completed answer. When streaming, consume complete events and distinguish connection closure from a successful terminal result. GoCux route aliases are product contracts; do not let a client-selected upstream model bypass server routing or display provider identities as customer configuration.

What to keep explicit

The route’s Idempotency-Key header is optional, and a repeated paid reservation can return a conflict instead of replaying the response. Do not assume retries are free replays.

Handle incomplete and refused work

Declare X-GoCux-Data-Classification exactly once. A data_classification field in the chat-completions body is rejected rather than used as the declaration. Missing classification is unclassified and can be refused by policy. An optional Idempotency-Key helps identify an operation, but a paid replay can return 409 without replaying the original response or contacting the provider again.

Bring this workflow into your workspace.

Set the scope. Review the evidence. Approve the steps that need it.

Open the workspace

Keep exploring