01
Connect your client
Use the API key supplied for SMOX.AI. Keep the real key on your server or in a private secret manager. Never expose it in browser code, a repository or application logs.
Base URL
llm.smox.ai/v1
Authentication
Bearer token
Transport
HTTPS + JSON
export SMOX_API_KEY="YOUR_API_KEY"
export SMOX_BASE_URL="https://llm.smox.ai/v1"
export SMOX_MODEL="YOUR_CHAT_MODEL_ID"Before sending a chat request, replace YOUR_CHAT_MODEL_ID in the environment setup and cURL example with the exact ID of a chat-capable model returned by GET /models. Confirm its supported capabilities in the model documentation.
02
Choose an available model
Call GET /models using the base URL above to list the models exposed by your API key before integrating. Use an exact returned model ID and check the model documentation for supported capabilities and endpoints; availability depends on your access.
curl --fail-with-body "$SMOX_BASE_URL/models" \
-H "Authorization: Bearer $SMOX_API_KEY"| Capability | Model selection | Use with chat endpoint |
|---|---|---|
| Chat / reasoning model | Choose an exact ID from GET /models that supports chat; confirm reasoning support separately. | Yes, for chat-capable models |
| Embedding model | Select a supported embedding model from GET /models and check its request schema. | No |
| Transcription | whisper-large-v3 — confirm availability with GET /models and check its request schema. | No |
03
Send your first prompt
Call the OpenAI-compatible chat completions endpoint. Read the completed answer from choices[0].message.content.
curl --fail-with-body "$SMOX_BASE_URL/chat/completions" \
-H "Authorization: Bearer $SMOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_CHAT_MODEL_ID",
"messages": [{
"role": "user",
"content": "Explain DNS in two sentences."
}]
}'04
Python quickstart
Install the official OpenAI Python SDK and provide the base URL shown above. The SDK then sends requests to this API rather than the default OpenAI endpoint.
python -m pip install openaiimport os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["SMOX_API_KEY"],
base_url=os.environ["SMOX_BASE_URL"],
timeout=120.0,
max_retries=2,
)
response = client.chat.completions.create(
model=os.environ["SMOX_MODEL"],
messages=[{
"role": "user",
"content": "Explain DNS in two sentences.",
}],
)
print(response.choices[0].message.content or "")Timeouts and retries
The 120-second timeout is an example client setting, not a service guarantee. Adjust it to the workload. SDK retries can increase total latency and repeat generation.
05
Stream the answer
Confirm that the selected chat model supports streaming before using this example. Set stream=True and append the content delta from each returned chunk.
stream = client.chat.completions.create(
model=os.environ["SMOX_MODEL"],
messages=[{"role": "user", "content": "What is DNS?"}],
stream=True,
)
try:
for chunk in stream:
if chunk.choices:
text = chunk.choices[0].delta.content or ""
print(text, end="", flush=True)
finally:
stream.close()
print()Conversation history: include earlier user and assistant messages in the messages array on each request. Keep the full history within the selected model's context limit.
06
Reasoning controls and limits
Start with a basic request. Add optional model-specific controls only after confirming that the selected model supports them.
Check the selected model's documentation for support and accepted values before adding this field. This placeholder-based example does not validate acceptance; acceptance alone does not confirm a behavioural change.
Confirm the current input and output limits in the model documentation. Limits for one model do not apply to every available model.
Use output limits such as max_tokens=256 only if supported by the selected model and endpoint. Inspect prompt, completion and total token usage when returned. Omit sampling controls unless needed and supported.
07
Handle common failures
Treat authentication, request validation, limits and temporary service failures differently. Do not retry every error automatically.
400 / 422Invalid requestCheck the model ID, message structure and optional parameters. Remove unsupported controls before retrying.
401 / 403Authentication or accessCheck the key and Bearer header. Confirm that the key is active and permitted to use the selected model.
404Route or model not foundUse the SDK base URL ending in /v1 without /chat/completions. Check the exact model ID against the model list.
429Rate or quota limitRespect Retry-After when present. Back off for rate limits and contact the SMOX.AI team if quota is exhausted.
5xx / timeoutTemporary failureUse bounded retries with exponential backoff and jitter. A retry can repeat generation and increase token usage.
08
Before you deploy
Move from a successful test request to a production integration with explicit security, reliability and observability choices.
Need an API key?
Request access and describe your intended workload.
For API input, output and cached token prices, view SMOX API pricing.
Prefer a conversation? Join the SMOX developer chat.
