Documentation

Complete guide to using TensorCortex for unified AI model access.

Quick Start

1. Create an Account

Sign up for TensorCortex and get your API key instantly. No credit card required for the free tier with 10,000 requests per month.

Get Started

2. Install the SDK

Install our SDK in your project. It's a drop-in replacement for the OpenAI SDK.

npm install @tensorcortex/sdk

3. Make Your First Request

Start using any AI model through our unified API. Switch between providers with a single line change.

import TensorCortex from '@tensorcortex/sdk'

const tc = new TensorCortex({ apiKey: 'tc_...' })

const response = await tc.chat.completions.create({
  model: 'openai/gpt-4o',
  messages: [{ role: 'user', content: 'Hello!' }]
})

4. Enable Smart Routing

Configure automatic fallbacks and cost optimization to maximize reliability and minimize costs.

View API Reference

Core Concepts

Smart Routing

Smart routing automatically selects the best model for each request based on your preferences: cost optimization, latency requirements, or capability matching.

Routing Strategies:

  • cost-optimized - Minimize costs while maintaining quality
  • latency-optimized - Fastest response times
  • quality-optimized - Best model for the task
  • balanced - Optimal trade-off between all factors

Model Naming Convention

Models are referenced using the format provider/model-name. This makes it easy to switch between providers.

Examples:

  • • openai/gpt-4o
  • • anthropic/claude-3.5-sonnet
  • • google/gemini-1.5-pro
  • • mistral/mistral-large
  • • meta/llama-3.1-405b

Fallback Configuration

Configure automatic fallbacks to ensure your application stays online even when a provider experiences issues.

{
  model: 'openai/gpt-4o',
  routing: {
    fallback: [
      'anthropic/claude-3.5-sonnet',
      'google/gemini-1.5-pro'
    ],
    maxRetries: 3
  }
}

Best Practices

Use Fallbacks for Production

Always configure at least 2-3 fallback models for production applications. This ensures your app stays online even during provider outages.

Monitor Your Usage

Use the dashboard analytics to track costs across providers. Identify opportunities to optimize by switching to more cost-effective models for certain use cases.

Cache Responses When Possible

For deterministic queries (temperature=0), enable response caching to reduce costs and latency for repeated requests.

Use Streaming for Long Responses

Enable streaming for chat applications to provide a better user experience with immediate feedback as tokens are generated.

Security

API Key Security

Your API keys provide full access to TensorCortex. Keep them secure and never expose them in client-side code.

Security Best Practices:

  • • Store API keys in environment variables
  • • Never commit keys to version control
  • • Rotate keys regularly
  • • Use separate keys for dev/staging/production
  • • Monitor key usage for anomalies

Compliance

TensorCortex is SOC 2 Type II certified and compliant with GDPR and CCPA. Enterprise customers can request additional compliance documentation and custom data residency options.

Need More Help?

Can't find what you're looking for? Our support team is here to help.