Skip to main content
This section is for Keywords AI LLM gateway users.
Use Keywords AI Gateway to call Together AI models while keeping unified observability (logs, cost, latency, and reliability metrics) in Keywords AI — and optionally charge usage to your own Together AI credits.

Prerequisites

  • A Keywords AI API key
  • A Together AI API key (BYOK credits)

Supported SDKs / integrations

Configuration

There are 2 ways to add your Together AI credentials to your requests:

Via UI (Global)

1

Navigate to Providers

Go to the Providers page. This page allows you to manage credentials for over 20+ supported providers.
Keywords AI Providers Page
2

Add your Together AI API Key

Select Together AI and paste your API key.
Add Together AI Credentials
3

Configure Load Balancing (Optional)

You can add multiple Together AI API keys for redundancy. Use the Load balancing weight field to determine how traffic is distributed between keys.

Via code (Per-Request)

You can pass credentials dynamically in the request body. This is useful if you need to use your users’ own API keys (BYOK credits). Add the customer_credentials parameter to your Gateway request:
{
  // Rest of the request body
  "customer_credentials": {
    "togetherai": {
      "api_key": "YOUR_TOGETHERAI_API_KEY"
    }
  }
}

Log Together AI requests

If you are not using the Gateway to proxy requests, you can still log your Together AI requests to Keywords AI asynchronously. This allows you to track cost, latency, and performance metrics for external calls.
Together AI Python SDK
import requests

url = "https://api.keywordsai.co/api/request-logs/create/"
payload = {
    "model": "meta-llama/Llama-3-8b-chat-hf",
    "prompt_messages": [
        {
            "role": "user",
            "content": "Explain machine learning in simple terms"
        }
    ],
    "completion_message": {
        "role": "assistant",
        "content": "Machine learning is like teaching computers to recognize patterns by learning from examples..."
    },
    "cost": 0.0005,
    "generation_time": 2.1,
    "customer_params": {
        "customer_identifier": "user_303"
    }
}
headers = {
    "Authorization": "Bearer YOUR_KEYWORDS_AI_API_KEY",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers, json=payload)

Get Started with Logging

Learn how to set up comprehensive logging for all your LLM requests