API

Chat Completions

Use the OpenAI-compatible Chat Completions API for text, vision, tools, and streaming.

Overview

Chat Completions is the primary endpoint for conversational model calls. It accepts a list of `messages` and returns an assistant response. When `stream` is `true`, output is delivered as Server-Sent Events.

Request

`POST https://uouo.cloud/v1/chat/completions`

Headers

HeaderRequiredDescription
AuthorizationYes`Bearer $UOUODUO_API_KEY`
Content-TypeYes`application/json`

Body parameters

ParameterTypeRequiredDefaultDescription
modelstringYes-Model ID, for example `gpt-4o-mini`.
messagesarrayYes-Conversation messages.
temperaturenumberNo1Sampling temperature from 0 to 2.
top_pnumberNo1Nucleus sampling value from 0 to 1.
streambooleanNofalseReturn SSE chunks when true.
max_tokensintegerNo-Legacy maximum output token field.
max_completion_tokensintegerNo-Maximum generated tokens.
toolsarrayNo-Function/tool definitions.
tool_choicestring or objectNo`auto`Controls tool selection.
response_formatobjectNo-JSON object or schema output constraints.
userstringNo-End-user identifier for audit and abuse prevention.

Example

curl https://uouo.cloud/v1/chat/completions \
  -H "Authorization: Bearer $UOUODUO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      { "role": "system", "content": "You are a concise production assistant." },
      { "role": "user", "content": "Summarize the release risk in three bullets." }
    ]
  }'

Streaming

Set `"stream": true` to receive `text/event-stream` chunks:

data: {"id":"chatcmpl_abc","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"First"},"finish_reason":null}]}

data: {"id":"chatcmpl_abc","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" point"},"finish_reason":null}]}

data: [DONE]

If `stream_options.include_usage` is enabled, the final chunk may include usage. Network interruptions can prevent the final usage chunk from arriving, so use console logs as the billing source of truth.

Response fields

FieldTypeDescription
idstringCompletion ID.
objectstringUsually `chat.completion`.
createdintegerUnix timestamp.
modelstringModel used by the route.
choicesarrayCandidate responses.
usageobjectPrompt, completion, and total token counts.

Errors

HTTPCodeMeaningSuggested action
400invalid_request_errorInvalid body or parameter range.Validate the request schema.
401unauthorizedMissing or invalid API key.Create or rotate a key in `/app/keys`.
403forbiddenKey or account cannot access the model.Check model access and workspace policy.
429rate_limit_exceededRate limit, quota, or balance issue.Review usage and retry with backoff.
500internal_errorGateway or upstream failure.Record request ID and check status.

Notes

  • Vision input requires a model that supports image content parts.
  • Tool call arguments should be validated by your server before execution.
  • Provider support for `seed`, `reasoning_effort`, and structured output can vary.
  • Control cost with `max_completion_tokens` and monitor `/app/usage`.
Chat Completions · uouo cloud