Skip to main content

Before You Start

Account Usage NoticeAccount registration is for API technical integration testing and enterprise system integration. The test credits ($0.05) provided to new accounts are only for:
  • API connectivity verification
  • Development debugging and technical testing
  • Pre-integration functionality verification
Not intended for production environments or public-facing content delivery services.
Get started with LaoZhang API in just 5 minutes. This guide shows how to:
  • Access 200+ AI models through a single unified API
  • Use existing OpenAI SDK with minimal code changes
  • Integrate with flexible payment options

Step 1: Create Account and Add Credits

Create Account

1

Sign Up

Visit LaoZhang API to create your accountNew accounts receive $0.05 test credits for API connectivity verification
2

Verify Email

  • Enter your email address
  • Create a secure password (8+ characters)
  • Verify your email via the confirmation link
3

Access Console

Log in to your console dashboardYou’ll see:
  • Account balance with test credits
  • Usage statistics and history
  • API key management

Add Credits

  1. Navigate to billing page
  2. Select your preferred amount
  3. Complete payment
  4. Credits available instantly
Credit Information:
  • Test credits for connectivity verification
  • Instant credit delivery after payment
  • Enterprise inquiries: support@laozhang.ai

Step 2: Get Your API Key

Generate Your API Key

  1. Navigate to Token Management
  2. Locate your Default Token
  3. Click Copy to clipboard
Advantage: Pre-configured and ready to use immediately
Security Best Practices:
  • API keys are shown only once - save securely immediately
  • Never commit keys to version control (use .gitignore)
  • Store keys in environment variables
  • Rotate keys periodically for enhanced security

Step 3: Make Your First API Call

Test Your Integration

Integration Configuration

Remember These Three Things

# API Base URL
base_url: https://api.laozhang.ai/v1

# API Key (starts with sk-)
api_key: sk-xxxxxxxxxxxxxx

# Model Name (plug and play)
model: gpt-4.1-mini  # or claude-sonnet-4-20250514, etc.

Complete Examples in Different Languages

# Install: pip install openai
from openai import OpenAI

# Initialize client
client = OpenAI(
    api_key="Your API Key",  # Get from LaoZhang API
    base_url="https://api.laozhang.ai/v1"  # Integration URL
)

# Examples of calling different models
def test_models():
    models = [
        "gpt-4.1-mini",  # Best value
        "claude-sonnet-4-20250514",  # Best for coding
        "deepseek-v3"  # Best Chinese model
    ]

    for model in models:
        try:
            response = client.chat.completions.create(
                model=model,
                messages=[
                    {"role": "system", "content": "You are a helpful AI assistant"},
                    {"role": "user", "content": "Introduce yourself in one sentence"}
                ],
                temperature=0.7,
                max_tokens=100
            )
            print(f"{model}: {response.choices[0].message.content}")
            print(f"Tokens used: {response.usage.total_tokens}\n")
        except Exception as e:
            print(f"{model} call failed: {e}\n")

if __name__ == "__main__":
    test_models()
Best Practice: Store API key in environment variables
import os
client = OpenAI(
    api_key=os.getenv("LAOZHANG_API_KEY"),
    base_url="https://api.laozhang.ai/v1"
)

Next Steps

Congratulations! You’ve successfully integrated LaoZhang API. Next you can:

Common Questions Quick Reference

Three signs:
  1. API call returns normal results (no errors)
  2. Response time under 1 second
  3. Can see call records in console
View call records: Usage Logs
Choose by scenario:Programming Development:
  • First choice: claude-sonnet-4-20250514
  • Alternative: deepseek-coder-v3
Article Writing:
  • First choice: gpt-4o
  • Alternative: claude-3.5-sonnet
Quick Response:
  • First choice: gpt-4.1-mini
  • Alternative: gemini-2.5-flash
Cost Sensitive:
  • First choice: deepseek-v3
  • Alternative: qwen-max
Immediate actions:
  1. Go to Token Management
  2. Revoke the compromised key immediately
  3. Generate a new API key
  4. Update the key in all your applications
Prevention measures:
  • Always use environment variables
  • Never hardcode keys in source code
  • Set spending limits per key
  • Rotate keys every 90 days
Options available:
  1. Add credits to your account via the billing page
  2. Switch to more cost-effective models (e.g., gpt-4o-mini, gemini-flash)
  3. Optimize your usage with max_tokens limits
Cost management tips:
  • Monitor usage in the console dashboard
  • Set budget alerts
  • Use streaming for better user experience
Payment options:
  • Credit/debit cards
  • Cryptocurrency (USDT on TRC20, Solana)
  • Wire transfer for enterprise accounts
Enterprise users: Contact support@laozhang.ai for invoicing and contract options.
Tip: Save your API key properly and check usage logs in the console regularly. Every request has message history for reasonable cost optimization.