📚 目录 / Contents

API Reference

Complete API documentation for TokenHub

API Specification

TokenHub is fully compatible with the OpenAI API specification. Only the Base URL needs to be changed.

ItemValue
Base URLhttps://hubwave.ai/v1
AuthAuthorization: Bearer sk-xxxxx
Content-Typeapplication/json

Chat Completions

POST /v1/chat/completions

Parameters

ParameterTypeRequiredDescription
modelstringModel name, e.g. gpt-4o
messagesarrayChat messages
streambooleanStreaming response
temperaturenumber0~2, default 1
max_tokensintegerMax output tokens
toolsarrayFunction calling tools

Example

curl https://hubwave.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "messages": [{"role": "user", "content": "Hello"}],
    "stream": true
  }'

Embeddings

POST /v1/embeddings

curl https://hubwave.ai/v1/embeddings \
  -H "Authorization: Bearer sk-xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "Hello world"
  }'

Error Codes

CodeMeaning
401Invalid API Key or insufficient quota
429Rate limit, please retry later
500Upstream error, auto-retried
503Channel unavailable