GLM 5.3 now online!Try it →
TokenGO

API Reference

Complete REST API endpoint documentation

API Reference

TokenGO provides an OpenAI-compatible REST API. You can use any OpenAI SDK or make direct HTTP requests.

Base Information

Base URL: https://api.tokengo.com/v1

Authentication: Bearer Token

Authorization: Bearer YOUR_API_KEY

Endpoints

Chat Completions

POST /chat/completions

Request Body:

{
  "model": "gpt-4o",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "Hello!" }
  ],
  "temperature": 0.7,
  "max_tokens": 150,
  "stream": false
}

Response:

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "gpt-4o",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! How can I help you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}

List Models

GET /models

Response:

{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "created": 1686935002,
      "owned_by": "openai"
    }
  ]
}

Create Embedding

POST /embeddings

Request Body:

{
  "model": "text-embedding-3-small",
  "input": "The food was delicious and the service..."
}

Error Codes

Status CodeDescription
200Success
400Invalid request parameters
401Authentication failed
429Rate limit exceeded or insufficient quota
500Internal server error

SDKs

TokenGO is fully compatible with the OpenAI SDK. Just change the base_url:

  • Python: pip install openai — set base_url="https://api.tokengo.com/v1"
  • TypeScript: npm install openai — set baseURL: "https://api.tokengo.com/v1"
  • Go / Java / Ruby: Use any OpenAI-compatible client with the base URL above