TokenLab

Compatibility Matrix

SDKs & Libraries

Use TokenLab with the SDK already in your application

Overview

You do not need a TokenLab-specific SDK. Keep the client your application already uses and change its API key and base URL:

  • OpenAI SDKs work with Chat Completions and Responses.
  • Anthropic SDKs work with Claude Messages.
  • Gemini / Google AI SDKs work with Gemini requests.

Open the matching integration page for client configuration and model-specific limits. For a complete first request, use the Quickstart.

Choose an SDK

OpenAI SDK Example

Use this for Chat Completions or Responses. The selected model must support the API method you call.

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-api-key",
    base_url="https://api.tokenlab.sh/v1"
)

response = client.responses.create(
    model="gpt-5.6-terra",
    input="Reply with: Connected to TokenLab."
)

print(response.output_text)

OpenAI Go Example

package main

import (
    openai "github.com/openai/openai-go/v3"
    "github.com/openai/openai-go/v3/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("sk-your-api-key"),
        option.WithBaseURL("https://api.tokenlab.sh/v1"),
    )

    _ = client
}

Anthropic SDK Example

from anthropic import Anthropic

client = Anthropic(
    api_key="sk-your-api-key",
    base_url="https://api.tokenlab.sh"
)

message = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}]
)

Which SDK should you use?

NeedSDK
Existing OpenAI-compatible clientOpenAI SDK on TokenLab /v1
Chat Completions, Responses, or embeddingsOpenAI SDK
Claude Messages fieldsAnthropic SDK
Gemini contents, files, cache, or toolsGemini / Google AI SDK
LangChain / LlamaIndex / Vercel AI SDKUse the dedicated integration pages

Configuration notes

On this page