smai.aismai.ai
Quick Start

Token Management

Create and manage your API tokens

What is an API Token

An API token (API Key) is your credential for calling the smai.ai API. Each API request requires a valid token for authentication.

Security Tip

Please keep your API token secure and do not disclose it to others or submit it to public code repositories.

Creating a Token

Access the Console

Log in to api.smai.ai and enter the user console.

Create a New Token

On the "Token Management" or "API Keys" page, click the "Create Token" button.

Set the Token Name

Set an easily recognizable name for your token, such as "Development Test" or "Production Environment".

Copy and Save

Once the token is created successfully, immediately copy and securely save it. The token will only be displayed once and cannot be viewed again.

sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Using the Token

In API requests, pass the token through the Authorization header:

curl https://api.smai.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4.1", "messages": [{"role": "user", "content": "Hello"}]}'

Or configure it in the SDK:

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-api-key",
    base_url="https://api.smai.ai/v1"
)

Managing Tokens

View Token List

On the "Token Management" page of the console, you can view all created tokens and their statuses.

Delete Token

If a token is no longer in use or may have been compromised, please delete it immediately:

  1. Find the target token in the token list
  2. Click the "Delete" button
  3. Confirm the deletion action

Note

After deleting a token, all applications using that token will no longer be able to access the API.

Best Practices

  • Regular Rotation: Regularly change API tokens to reduce the risk of exposure
  • Environment Isolation: Create different tokens for development, testing, and production environments
  • Environment Variables: Store tokens in environment variables instead of hardcoding them in the code
  • Least Privilege: Only create necessary tokens and promptly delete unused tokens

On this page