diff --git a/docs/docs.json b/docs/docs.json index 2e7b990055..59121c5cad 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -220,6 +220,7 @@ }, "getting-started/integration-method/openrouter", "getting-started/integration-method/perplexity", + "getting-started/integration-method/tokenlab", "getting-started/integration-method/together", { "group": "xAI", diff --git a/docs/getting-started/integration-method/tokenlab.mdx b/docs/getting-started/integration-method/tokenlab.mdx new file mode 100644 index 0000000000..1f5c5bc445 --- /dev/null +++ b/docs/getting-started/integration-method/tokenlab.mdx @@ -0,0 +1,87 @@ +--- +title: "TokenLab Integration" +sidebarTitle: "TokenLab" +description: "Connect Helicone with TokenLab's OpenAI-compatible API and monitor requests across GPT, Claude, Gemini, DeepSeek, Qwen, Kimi, MiniMax, GLM, and Grok model families." +"twitter:title": "TokenLab Integration - Helicone OSS LLM Observability" +--- + +[TokenLab](https://tokenlab.sh/) provides an OpenAI-compatible API for many frontier and open model families. You can route TokenLab requests through Helicone Gateway by keeping TokenLab as the target provider and adding Helicone observability headers. + +You can follow TokenLab's documentation here: [https://docs.tokenlab.sh/](https://docs.tokenlab.sh/) + +# Gateway Integration + + + + Log into [helicone](https://www.helicone.ai) or create an account. Once you have an account, you + can generate a [Helicone API key](https://helicone.ai/developer). + + + Log into [TokenLab](https://tokenlab.sh/dashboard) and generate an API key from your dashboard. + + +```bash +HELICONE_API_KEY= +TOKENLAB_API_KEY= +``` + + + Send OpenAI-compatible requests to `https://gateway.helicone.ai/v1` and set + `Helicone-Target-Url` to `https://api.tokenlab.sh`. + + + +## Example + +```bash +curl --request POST \ + --url https://gateway.helicone.ai/v1/chat/completions \ + --header "Authorization: Bearer $TOKENLAB_API_KEY" \ + --header "Helicone-Auth: Bearer $HELICONE_API_KEY" \ + --header "Helicone-Target-Url: https://api.tokenlab.sh" \ + --header "Helicone-Target-Provider: TokenLab" \ + --header "Content-Type: application/json" \ + --data '{ + "model": "gpt-5.4-mini", + "messages": [ + { + "role": "user", + "content": "Say hello from TokenLab through Helicone." + } + ] + }' +``` + +## OpenAI SDK + +```typescript +import OpenAI from "openai"; + +const client = new OpenAI({ + apiKey: process.env.TOKENLAB_API_KEY, + baseURL: "https://gateway.helicone.ai/v1", + defaultHeaders: { + "Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`, + "Helicone-Target-Url": "https://api.tokenlab.sh", + "Helicone-Target-Provider": "TokenLab", + }, +}); + +const response = await client.chat.completions.create({ + model: "claude-sonnet-5", + messages: [{ role: "user", content: "Write a one-sentence product summary." }], +}); +``` + +## Model Discovery + +TokenLab exposes an OpenAI-compatible model list at: + +```bash +curl https://api.tokenlab.sh/v1/models \ + --header "Authorization: Bearer $TOKENLAB_API_KEY" +``` + +Example model IDs include `gpt-5.5`, `claude-opus-4-8`, `gemini-3.5-flash`, `deepseek-v4-pro`, `qwen3.7-max`, `kimi-k2.7-code`, and `grok-4-fast`. + +TokenLab also supports native API families such as Responses, Anthropic Messages, and Gemini-compatible endpoints. Use the OpenAI-compatible `/v1` API shown above when sending requests through Helicone Gateway.