SDK

OpenAI SDK Compatible

Use the official OpenAI SDK with TENSORAXIS and understand compatibility boundaries.

How It Works

TENSORAXIS provides a unified OpenAI-compatible entry point for common APIs. For Chat Completions, Responses, Embeddings, Images, Audio and similar endpoints, you usually only need to change two parameters when initializing the SDK:

  • api_key → your TENSORAXIS API Key
  • base_urlhttps://api.tensoraxis.com/v1

Some provider extensions and async task APIs have their own request-body conventions. In particular, video generation should not copy an upstream provider's raw content[] body directly; see Video Generation.

Python

pip install openai
from openai import OpenAI

client = OpenAI(
    api_key="your-tensoraxis-api-key",
    base_url="https://api.tensoraxis.com/v1",
)

Node.js / TypeScript

npm install openai
import OpenAI from 'openai'

const client = new OpenAI({
  apiKey: process.env.TENSORAXIS_API_KEY,
  baseURL: 'https://api.tensoraxis.com/v1',
})
# .env
OPENAI_API_KEY=your-tensoraxis-api-key
OPENAI_BASE_URL=https://api.tensoraxis.com/v1

Once set, the OpenAI SDK reads these environment variables automatically:

from openai import OpenAI
client = OpenAI()

Supported Endpoints

EndpointPathDescription
Chat CompletionsPOST /v1/chat/completionsChat completion with streaming support
ResponsesPOST /v1/responsesOpenAI Responses API
EmbeddingsPOST /v1/embeddingsText vectorization
ModelsGET /v1/modelsList available models
ImagesPOST /v1/images/generations, POST /v1/images/editsImage generation and editing, depending on model capability
AudioPOST /v1/audio/transcriptions, POST /v1/audio/translations, POST /v1/audio/speechAudio transcription, translation and speech generation
RerankPOST /v1/rerankReranking, typically called with direct HTTP
VideoPOST /v1/video/generations, GET /v1/video/generations/{task_id}Async video task API; see Video Generation
OpenAI/Sora VideoPOST /v1/videos, GET /v1/videos/{task_id}OpenAI/Sora-style video compatibility API

Video API Notes

Video generation is asynchronous. For Seedance / Doubao video models, TENSORAXIS accepts the unified task request:

{
  "model": "doubao-seedance-1-0-pro-250528",
  "prompt": "A cinematic cat watching rain by the window",
  "images": ["https://example.com/cat.png"],
  "metadata": {
    "resolution": "1080p",
    "ratio": "16:9",
    "duration": 5
  }
}

The upstream Volcengine Ark content[] structure is generated by the adapter. End users do not need to send it manually.