API Authentication

โš ๏ธ BETA: GMTech's API is currently in beta testing. We welcome your feedback!

GMTech uses API key authentication compatible with OpenAI's format.

Overview

  • Method: Bearer token authentication
  • Format: Keys start with gmtech_ prefix
  • Header: Authorization: Bearer gmtech_your_key
  • Scope: Team-based with individual tracking

Getting Your API Key

๐Ÿ“ธ API Keys Interface

API Keys Page

The API Keys page showing the beta badge and key management interface

๐Ÿ“ธ SCREENSHOT NEEDED: api-keys-interface.png
What to capture: The /users/api-keys/ page
Show: Beta badge in header, existing keys list (with prefixes redacted), "Create New API Key" button, usage example section
Tips: Navigate to /users/api-keys/ and capture the full page
  1. Login to app.gmtech.com
  2. Navigate to Team Settings โ†’ API Keys
  3. Generate a new key with a descriptive name
  4. Copy immediately (shown only once)
  5. Store securely - never commit to version control

Basic Usage

# Set environment variable
export GMTECH_API_KEY="gmtech_your_api_key"
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://app.gmtech.com/api/v1",
    api_key=os.getenv("GMTECH_API_KEY")
)

response = client.chat.completions.create(
    model="gpt-4-turbo",
    messages=[{"role": "user", "content": "Hello!"}]
)

Direct Usage

from openai import OpenAI

client = OpenAI(
    base_url="https://app.gmtech.com/api/v1",
    api_key="gmtech_your_api_key"
)

Rate Limits

Tier Requests/min Tokens/min
Free 60 40K
Pro 3,000 250K
Team 5,000 500K

Error Handling

from openai import AuthenticationError, RateLimitError

try:
    response = client.chat.completions.create(...)
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit exceeded - slow down requests")

Security Best Practices

โœ… Do

  • Store keys in environment variables
  • Use descriptive key names
  • Rotate keys regularly
  • Monitor usage in dashboard
  • Set appropriate rate limits

โŒ Don't

  • Hardcode keys in source code
  • Commit keys to version control
  • Share keys in email/chat
  • Use keys in client-side JavaScript
  • Ignore usage monitoring

Team Management

All API keys within a team:

  • Share unified billing
  • Use the same credit pool
  • Have individual tracking for attribution
  • Can have different rate limits

Troubleshooting

"Invalid API key" Error

  • Verify key starts with gmtech_
  • Check for whitespace (use .strip())
  • Confirm key is active in dashboard

Rate Limit Exceeded

import time
from openai import RateLimitError

def retry_with_backoff(client, **kwargs):
    for attempt in range(3):
        try:
            return client.chat.completions.create(**kwargs)
        except RateLimitError:
            if attempt < 2:
                time.sleep(2 ** attempt)  # 1s, 2s
            else:
                raise

Permission Denied

  • Check key permissions in dashboard
  • Verify model access for your tier
  • Ensure key hasn't been revoked

Key Management

View in dashboard:

  • Usage stats: Request count, costs
  • Last used: Most recent activity
  • Status: Active or revoked
  • Permissions: Model access and limits

To revoke a key, visit the API Keys page and click Revoke.


Previous: โ† Overview | Next: OpenAI Compatible โ†’

results matching ""

    No results matching ""