TOKENOPENTOKENOPEN
User GuideAPI ReferenceHelp & Support
Quick Start

Make Your First API Call in 5 Minutes

Complete your first API call in five minutes

This guide walks you through obtaining an API key and making your first request in 5 minutes. For registration and login steps, see Console Overview → Register an Account.

The examples in this guide are based on AI Model APIs (Chat, Embeddings, Audio, etc.). For complete API definitions, request parameters, and response formats, see API Reference → AI Model APIs.

Quick Start

Get an API Key

After logging into the console, click "API Keys" in the left sidebar, then click "Create Key" in the top right.

Enter a key name (e.g., my-first-key), leave the other options at their defaults, and click "Submit". The system will generate an API key starting with sk- for calling AI model APIs. For detailed steps, see Create an API Key.

The system will only display the full key once at creation time. Copy and save it somewhere secure immediately.

Get the API Endpoint

The platform's API is fully compatible with the OpenAI API format. Simply replace the Base URL with the platform address:

https://api.tokenopen.ai/v1

Make Your First Request

Replace YOUR_API_KEY in the code below with the API key you just created, then run it.

curl https://api.tokenopen.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5.4-mini",
    "messages": [
      {
        "role": "user",
        "content": "Hello, please introduce yourself."
      }
    ]
  }'
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.tokenopen.ai/v1",
)

response = client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[
        {"role": "user", "content": "Hello, please introduce yourself."}
    ],
)

print(response.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://api.tokenopen.ai/v1",
});

const response = await client.chat.completions.create({
  model: "gpt-5.4-mini",
  messages: [
    { role: "user", content: "Hello, please introduce yourself." }
  ],
});

console.log(response.choices[0].message.content);
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("YOUR_API_KEY"),
        option.WithBaseURL("https://api.tokenopen.ai/v1"),
    )

    resp, err := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
        Model: openai.F("gpt-5.4-mini"),
        Messages: openai.F([]openai.ChatCompletionMessageParamUnion{
            openai.UserMessage("Hello, please introduce yourself."),
        }),
    })
    if err != nil {
        panic(err)
    }
    fmt.Println(resp.Choices[0].Message.Content)
}

API Parameters

ParameterTypeDescription
modelstringThe model to call, e.g., gpt-5.4-mini, claude-sonnet-4-6
messagesarrayArray of conversation messages; each message has a role and content
temperaturenumberOptional. Controls output randomness; range 0–2, default 1
max_tokensintegerOptional. Caps the maximum number of output tokens
streambooleanOptional. Set to true to enable streaming output

Streaming Output Example

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.tokenopen.ai/v1",
)

stream = client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Write a short poem about spring."}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="", flush=True)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://api.tokenopen.ai/v1",
});

const stream = await client.chat.completions.create({
  model: "gpt-5.4-mini",
  messages: [{ role: "user", content: "Write a short poem about spring." }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

Common Model Names

ModelName
GPT-5.5gpt-5.5
GPT-5.4gpt-5.4
GPT-5.4-minigpt-5.4-mini
GPT-5.4-nanogpt-5.4-nano
Claude Opus 4.7claude-opus-4-7
Claude Sonnet 4.6claude-sonnet-4-6
Gemini 3.5 Flashgemini-3.5-flash
Gemini 3.1 Progemini-3.1-pro-preview
DeepSeek-V4 Prodeepseek-v4-pro
Qwen3-235Bqwen3-235b-a22b

For the full model list and real-time pricing, visit the "Pricing" page in the console.

Troubleshooting

Error CodeCauseSolution
401 UnauthorizedAPI key is invalid or malformedCheck that the key is complete and starts with sk-
403 ForbiddenCurrent group has no access to this modelSwitch to another model or contact support to upgrade your group
429 Too Many RequestsRate limit exceededReduce request frequency or apply for a higher-tier group
402 Payment RequiredInsufficient account creditsGo to the Wallet page to top up
500 Internal Server ErrorUpstream service temporarily unavailableRetry later or switch to another model

Migrating from OpenAI

The platform is fully compatible with the OpenAI API protocol. Migration requires only two steps — no business logic changes needed.

Step 1: Replace the Base URL

Replace https://api.openai.com in your code or config with https://api.tokenopen.ai.

Step 2: Replace the API Key

Replace your OpenAI sk- key with an API key created in the platform console.

Original VariableNew Value
OPENAI_API_KEYPlatform API key (starts with sk-)
OPENAI_BASE_URLhttps://api.tokenopen.ai/v1
ANTHROPIC_BASE_URLhttps://api.tokenopen.ai

Once these two steps are complete, your application will route through this platform — no further changes required.

View Call Results

After making a call, go to "Logs" in the console to view real-time details for each request.

FieldDescription
TimeTimestamp when the request was made
ModelThe model used in this call
Key NameThe API key name used
Input TokensNumber of input tokens consumed
Output TokensNumber of output tokens generated
Credits UsedCredits deducted for this call
StatusSuccess / Failed / Timeout

For daily or per-model usage trends, visit the "Dashboard" page in the console.

Last updated on