API Examples
Sample curl commands to get you started with the TensorX API. All examples use the OpenAI-compatible endpoint.
Basic Chat Completion
A simple chat request with GLM-5.1:
curl https://api.tensorx.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "z-ai/glm-5.3",
"messages": [
{"role": "user", "content": "What is the capital of France?"}
]
}'Multi-turn Conversation
Include conversation history for context:
Streaming Response
Get responses token-by-token for real-time output:
Code Generation
Ask for code with a system prompt:
With Temperature Control
Adjust creativity with temperature (0.0 = focused, 1.0 = creative):
List Available Models
Check which models are available:
Python Example
Using the OpenAI Python SDK:
JavaScript/Node.js Example
Using the OpenAI Node.js SDK:
Model metadata
Use GET /v1/model/info to inspect current capability flags and limits. See Models for the discovery commands and response fields.
Last updated
Was this helpful?

