Ox Alpha chat completions: Step-by-Step API Setup Guide - API

Ox Alpha chat completions: Step-by-Step API Setup Guide

Learn how to configure Ox Alpha chat completions, authenticate requests, set reasoning options, control generation, and read responses.

2026-08-22
Ox Alpha Wiki Team
Quick Guide
  • Ox Alpha chat completions use the stealth/ox-alpha model identifier.
  • Authentication requires a Tokenra API key sent as a Bearer token.
  • Request format follows the familiar OpenAI-style messages array.
  • Reasoning mode is enabled with reasoning.enabled: true when supported.
  • Response data appears primarily in choices[0].message.content.

Ox Alpha chat completions at a glance

Ox Alpha chat completions provide a server-side API interface for sending conversational messages to the stealth/ox-alpha model. The basic request uses JSON and requires two fields: model and messages. Optional controls can adjust reasoning, output length, sampling, and tool behavior.

The integration is designed around a familiar chat-completion structure. Each message includes a role and content, allowing applications to send user prompts and, when needed, system or assistant context. This makes the endpoint suitable for chat interfaces, internal tools, automation workflows, and structured application features.

The official Ox Alpha API documentation describes the required request structure, authentication headers, available parameters, and successful response format.

Model

Use the exact identifier stealth/ox-alpha in the request body.

Messages

Send an array of conversation objects with a role and content value.

Reasoning

Request provider-supplied reasoning fields by enabling the reasoning option.

Response

Read the generated answer from choices[0].message.content.

RequirementValuePurpose
Modelstealth/ox-alphaSelects the Ox Alpha model
MessagesArraySupplies the conversation context
Content typeJSONFormats the request body
AuthenticationBearer tokenAuthorizes the API call
Integration Tip

Start with only model and messages. Add generation controls or tools after the basic completion returns the expected response.

Authentication and first request

The API key should remain on a trusted server or protected backend. Do not place a production key in browser JavaScript, public repositories, mobile bundles, or other client-side packages that users can inspect.

Authentication uses a Tokenra API key in the Authorization header. The value follows the Bearer token convention. Requests should also declare JSON content with Content-Type: application/json.

The HTTP-Referer and X-Title headers are optional metadata. They can identify the application or provide provider-ranking context, but they are not listed as required headers for a basic request.

1

Store the API key securely

Save the Tokenra API key in a server-side environment variable such as TOKENRA_API_KEY. Keep the key outside source control and avoid printing it in logs.

2

Prepare the JSON body

Set model to stealth/ox-alpha and provide a messages array. Each message should include a valid role and text content.

3

Send the POST request

Make a server-side POST request to the Chat Completions endpoint documented by Ox Alpha. Include the Bearer authorization header and JSON content type.

4

Read the assistant message

Parse the JSON response and inspect choices[0].message.content for the generated completion.

A minimal JavaScript pattern can keep the endpoint configurable without hard-coding deployment details:

const response = await fetch(process.env.CHAT_COMPLETIONS_URL, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TOKENRA_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "stealth/ox-alpha",
    messages: [
      {
        role: "user",
        content: "What AI model are you?"
      }
    ]
  })
})

const data = await response.json()
const answer = data.choices?.[0]?.message?.content
HeaderRequired statusRecommended value
AuthorizationRequiredBearer ${TOKENRA_API_KEY}
Content-TypeRequiredapplication/json
HTTP-RefererOptionalYour application URL
X-TitleOptionalYour application name
Security Warning

Never expose a production API key in browser code, public Git repositories, client-side bundles, screenshots, or error messages.

Request parameters and generation controls

The required request body is intentionally small, but Ox Alpha supports several optional controls. Use them selectively because each parameter changes how the application handles generation.

max_tokens limits the maximum number of generated tokens. temperature changes sampling variety, while top_p limits selection to a cumulative probability range. The documented defaults are 1 for temperature and 0.95 for top-p. top_k defaults to 0 and can limit the number of candidate tokens considered at each generation step.

Reasoning is controlled through an object rather than a standalone Boolean. Set reasoning.enabled to true when the application needs the provider to return reasoning-related fields and the selected service supports them.

ParameterTypeDocumented defaultUse
modelStringNoneRequired model identifier
messagesArrayNoneRequired conversation input
reasoningObjectNoneControls reasoning behavior
max_tokensIntegerNoneLimits generated output length
temperatureFloat1Controls sampling variety
top_pFloat0.95Limits cumulative token probability
top_kInteger0Limits candidate tokens per step
toolsArrayNoneDefines OpenAI-format tools
tool_choiceString or objectNoneControls tool selection

Predictable Output

Use a lower temperature when consistency matters more than stylistic variation.

Longer Answers

Set max_tokens according to the response size your interface can display and store.

Tool Workflows

Provide tools and configure tool_choice only when the application has a tool execution path.

A practical configuration should match the task:

  • For classification or extraction, favor constrained output and a conservative sampling setup.
  • For brainstorming, allow more sampling variety while keeping a reasonable output limit.
  • For tool calling, define the tool schema clearly and validate returned arguments before execution.
  • For reasoning-enabled requests, decide which returned fields should be stored, displayed, or omitted.
Parameter Note

The documentation lists temperature, top_p, and top_k as separate controls. Change one sampling strategy at a time during testing so you can identify its effect.

Response format and application handling

A successful response uses the chat-completion structure. The generated assistant message is located at choices[0].message.content. The response also includes an identifier, object type, creation timestamp, selected model, provider information, completion status, and usage details.

When reasoning is enabled and available, inspect choices[0].message.reasoning and choices[0].message.reasoning_details. These fields may contain provider-supplied reasoning output and should be handled according to the privacy, security, and product requirements of your application.

The finish_reason field explains why generation stopped. A value such as stop indicates normal completion, while a token-limit state signals that the configured output limit may have been reached.

Response pathMeaningApplication use
idCompletion identifierTrace logs and support requests
modelModel used for generationConfirm routing and configuration
choices[0].message.contentMain assistant responseDisplay or process generated text
choices[0].message.reasoningReasoning text when availableHandle selectively and securely
choices[0].message.reasoning_detailsStructured reasoning detailsInspect only when required
choices[0].finish_reasonCompletion stop stateDetect normal or limited output
usage.total_tokensTotal prompt and completion tokensMonitor request consumption
usage.costReported request costReview service usage metadata

Use defensive parsing rather than assuming every optional property is present. A valid application should handle an empty choices array, a missing content value, an unavailable reasoning field, and an unexpected finish state without crashing.

Response Handling Tip

Treat choices[0].message.content as the primary output, and check optional reasoning fields only after confirming they exist in the response.

Production checklist and FAQ

Before releasing an Ox Alpha integration, verify the request path, secret handling, response parser, and operational safeguards. Test both ordinary completions and edge cases such as empty output, long prompts, tool calls, or incomplete generation.

Production Readiness Checklist:

  • Store the Tokenra API key in a server-side environment variable
  • Use the exact stealth/ox-alpha model identifier
  • Send model and messages as a JSON request body
  • Parse choices[0].message.content defensively
  • Review reasoning and usage fields before exposing them to users
Test areaWhat to verifyPassing condition
AuthenticationBearer token and secret storageRequest works without exposing credentials
Request bodyModel and messages fieldsJSON matches the documented structure
GenerationLimits and sampling controlsOutput fits the product requirement
ReasoningOptional reasoning fieldsMissing fields do not break parsing
Completion statefinish_reasonApplication handles normal and limited output
UsageToken metadataLogs support monitoring without leaking prompts

For ongoing maintenance, keep the endpoint configuration separate from application logic. Log request identifiers and completion states where appropriate, but avoid recording sensitive prompts, API keys, or provider-returned reasoning unless there is a clear operational need.

Q: What model identifier does Ox Alpha chat completions require?

The documented model identifier is `stealth/ox-alpha`. A basic request also requires a `messages` array.

Q: Which headers are required for an Ox Alpha request?

Use a Bearer Tokenra API key in the `Authorization` header and send the body with `Content-Type: application/json`. `HTTP-Referer` and `X-Title` are optional.

Q: Where is the generated response located?

Read the main assistant response from `choices[0].message.content`. Also inspect `finish_reason` when your application needs to distinguish normal completion from a limit.

Q: How does reasoning work in the request?

Add a `reasoning` object with `enabled` set to `true`. When reasoning is available, related values may appear in the assistant message under `reasoning` and `reasoning_details`.

Maintenance Tip

Recheck the official Ox Alpha API documentation on 2026-08-22 and whenever your provider configuration changes.