OpenAI-Compatible API

OpenAI-compatible endpoints for Chat Completions, Embeddings, Images, Audio, Responses, and more

TokenLink provides a complete OpenAI-compatible API — you can call it directly with any OpenAI SDK or compatible tool.

Chat Completions

POST /openai/chat/completions

The most commonly used chat completion endpoint, supporting streaming and non-streaming.

Request example

curl https://tokenlink.stelarx.ai/openai/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain what an API proxy is"}
    ],
    "temperature": 0.7,
    "stream": false
  }'

Streaming request

curl https://tokenlink.stelarx.ai/openai/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5",
    "messages": [{"role": "user", "content": "Write a poem"}],
    "stream": true
  }'

Request parameters

ParameterTypeRequiredDescription
modelstringModel ID
messagesarrayList of messages
temperaturenumberSampling temperature (0-2)
top_pnumberNucleus sampling (0-1)
max_tokensintegerMaximum output tokens
streambooleanWhether to stream output
toolsarrayTool definitions
tool_choiceanyTool selection strategy

Response

{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "model": "gpt-5",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "An API proxy is..."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 30,
    "completion_tokens": 150,
    "total_tokens": 180
  }
}

Embeddings

POST /openai/embeddings
curl https://tokenlink.stelarx.ai/openai/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "TokenLink is an AI API proxy platform"
  }'

Images

POST /openai/images/generations
curl https://tokenlink.stelarx.ai/openai/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "dall-e-3",
    "prompt": "An illustration of a futuristic city",
    "size": "1024x1024"
  }'

Audio

Text-to-speech (TTS)

POST /openai/audio/speech
curl https://tokenlink.stelarx.ai/openai/audio/speech \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "tts-1",
    "input": "Hello, welcome to TokenLink",
    "voice": "alloy"
  }' --output speech.mp3

Speech-to-text (Whisper)

POST /openai/audio/transcriptions

Responses API (new)

POST /openai/responses

OpenAI's recommended next-generation API, supporting reasoning, tool calling, and other advanced features.

curl https://tokenlink.stelarx.ai/openai/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5",
    "input": "Analyze the performance issues in this code",
    "reasoning": {"effort": "high"}
  }'

Rerank

POST /openai/rerank
curl https://tokenlink.stelarx.ai/openai/rerank \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5",
    "query": "API proxy",
    "documents": ["Document 1", "Document 2", "Document 3"],
    "top_n": 2
  }'

List models

GET /openai/models
curl https://tokenlink.stelarx.ai/openai/models \
  -H "Authorization: Bearer YOUR_API_KEY"