Tokener CA
Service online
Sign up
DocsLiteLLM Integration

LiteLLM Integration

Integrate the Tokener CA OpenAI-compatible API in the LiteLLM Python SDK or LiteLLM Proxy.

Updated:

Use Cases

LiteLLM can unify different model providers into OpenAI-style calls, and it can also act as an internal LLM Gateway for your team. Tokener CA already provides an OpenAI-compatible /v1/chat/completions, so you can integrate it through LiteLLM's OpenAI provider.

There are two common ways to integrate:

MethodBest for
LiteLLM Python SDKCalling Tokener CA directly from a Python project
LiteLLM ProxyIntegrating LiteLLM internally first, then letting other OpenAI-compatible clients access LiteLLM

Prepare Environment Variables

Bash
export SKYPOOL_API_KEY="stc-..."export SKYPOOL_API_BASE="https://a.skypool.xyz/v1"

PowerShell:

PowerShell
$env:SKYPOOL_API_KEY="stc-..."$env:SKYPOOL_API_BASE="https://a.skypool.xyz/v1"

Method 1: Call Directly from the Python SDK

Install LiteLLM:

Bash
uv add litellm

Or use pip:

Bash
pip install litellm

Minimal call example:

Python
import osfrom litellm import completion response = completion(    model="openai/gemma4:26b",    api_key=os.environ["SKYPOOL_API_KEY"],    api_base=os.environ.get("SKYPOOL_API_BASE", "https://a.skypool.xyz/v1"),    messages=[        {            "role": "user",            "content": "In one sentence, explain that LiteLLM is already integrated with Tokener CA.",        }    ],    max_tokens=128,) print(response.choices[0].message.content)

Streaming call:

Python
import osfrom litellm import completion stream = completion(    model="openai/gemma4:26b",    api_key=os.environ["SKYPOOL_API_KEY"],    api_base=os.environ.get("SKYPOOL_API_BASE", "https://a.skypool.xyz/v1"),    messages=[        {            "role": "user",            "content": "Introduce Tokener CA in three points.",        }    ],    stream=True,    max_tokens=512,) for chunk in stream:    delta = chunk.choices[0].delta.content    if delta:        print(delta, end="")

Note: LiteLLM's openai/<model> prefix indicates that the call is made in the OpenAI-compatible way; the real model ID is still the Tokener CA platform model name.

Method 2: LiteLLM Proxy

Create litellm_config.yaml:

YAML
model_list:  - model_name: "gemma4:26b"    litellm_params:      model: "openai/gemma4:26b"      api_base: os.environ/SKYPOOL_API_BASE      api_key: os.environ/SKYPOOL_API_KEY litellm_settings:  drop_params: true

Start LiteLLM Proxy:

Bash
litellm --config litellm_config.yaml --port 4000

Then other OpenAI-compatible clients can access LiteLLM:

Python
from openai import OpenAI client = OpenAI(    api_key="anything",    base_url="http://127.0.0.1:4000",) completion = client.chat.completions.create(    model="gemma4:26b",    messages=[        {            "role": "user",            "content": "Return a one-line message confirming LiteLLM Proxy integration succeeded.",        }    ],) print(completion.choices[0].message.content)

Verify the Upstream

If LiteLLM reports an error, first bypass LiteLLM and verify Tokener CA directly:

Bash
curl -X POST "https://a.skypool.xyz/v1/chat/completions" \  -H "Authorization: Bearer <consumer_api_key>" \  -H "Content-Type: application/json" \  --data-raw '{    "model": "gemma4:26b",    "messages": [      {        "role": "user",        "content": "Return a short message confirming the integration succeeded."      }    ],    "max_tokens": 64,    "stream": false  }'

Troubleshooting Checklist

SymptomHow to handle
AuthenticationErrorCheck whether SKYPOOL_API_KEY is set, and make sure it is not mixed up with a LiteLLM Proxy virtual key
NotFoundErrorCheck whether model is written as openai/<platform model ID>
Proxy model not taking effectCheck whether model_name matches the model in the client request
Incompatible parametersKeep drop_params: true in litellm_settings, then enable advanced parameters one by one
Streaming issuesRun a non-streaming request first, then turn on stream=True

References