TOKI
Guides

Authentication

Learn how to authenticate your API requests with TOKI.

API Key Authentication

All model API requests require authentication using an API key. Include your key in the Authorization header, using the same format as the OpenAI API:

Authorization: Bearer YOUR_API_KEY

Creating API Keys

You can create and manage API keys in the TOKI console:

  1. Sign in and open the API Keys page.
  2. Click Create Key.
  3. Set the key name, supplier, quota, and expiration.
  4. Copy the key after it is created and store it securely.

The full API key may only be shown when it is created. Copy it immediately and store it securely using environment variables or a secret manager.

Key Best Practices

PracticeDescription
Use environment variablesNever hardcode keys in source code
Rotate regularlyRotate keys every 90 days
Use scoped keysCreate separate keys for different environments
Monitor usageTrack Token balance and key usage in the console

OpenAI SDK Authentication

When using the official OpenAI SDK, set apiKey to your TOKI API key and point baseURL to TOKI:

import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://www.tokiai.ai/v1',
  apiKey: process.env.TOKI_API_KEY,
});

Common Authentication Errors

CaseHow to handle it
Missing Authorization headerCheck that the header includes the Bearer prefix.
Invalid or disabled API keyConfirm the key status in the console or create a new key.
Expired keyUpdate the expiration or create a new API key.
Insufficient quotaCheck account Token balance and key-level quota limits.

On this page