This page documents the maintained shared
tokenlab-api-integration skill. The canonical distribution lives in hedging8563/tokenlab-skills, where the public repository intentionally keeps only this skill.Use this page for skill installation and agent workflow guidance. For endpoint-specific setup, use the dedicated SDK, client, or API reference page for that tool.
What The Skill Does
- Generates minimal runnable examples for TokenLab chat, image, audio, video, translation, and other API families.
- Uses
https://api.tokenlab.sh/v1for OpenAI-compatible clients and explains when to switch to native Anthropic or Gemini routes. - Discovers models with
/v1/models,/llms.txt, andrecommended_forshortlists instead of guessing from stale lists. - Reads a model details before retrying non-chat requests, so unsupported fields are not silently dropped.
- Handles Agent-First error hints such as
did_you_mean,suggestions,retry_after, andrecommended_request.
Install
Use the canonical non-interactive install command:This installs the shared
tokenlab-api-integration skill from the TokenLab skills repository.If your tool does not support the installer, copy skills/tokenlab-api-integration/ from the repository into your tool’s shared skills or rules directory.Update Existing Installs
If you installed the skill earlier, rerun the same command to update to the current public package.Verify Installation
Ask your coding agent:tokenlab-api-integration, the installation succeeded.
Get Your API Key
1
Visit TokenLab
Go to tokenlab.sh
2
Sign In
Create an account or log in
3
Get API Key
Open Dashboard → API Keys and create a new key
4
Copy The Key
Your key starts with
sk-.... Store it securely.Recommended Agent Workflow
- Start with the smallest working example that matches the user’s requested language and API family.
- When model choice is open, call
/v1/modelsorhttps://api.tokenlab.sh/llms.txtbefore hardcoding a model. - For non-chat work, call
/v1/models?recommended_for=<scene>where<scene>isimage,video,music,3d,tts,stt,embedding,rerank, ortranslation. - Before changing a failed non-chat request, read
/v1/models/:modeland align withsupported_operations,supported_parameters,request_endpoint,request_endpoint_by_operation,request_shape_mode, andrecommended_request. - If the API returns an Agent-First error, use the structured fields to correct the request and retry only when the error is retryable.
Minimal Chat Example
This example uses the OpenAI Python SDK with the TokenLab base URL:Model Discovery
Prefer live discovery over stale bundled lists:Native Protocol Selection
OpenAI-compatible/v1 is the default path for common chat, image, embedding, audio, and rerank examples. Do not infer native protocol availability from a model or provider name, or from Chat response headers. Read GET /v1/models/{model} and use only a format listed in tokenlab.accepted_request_formats.
The protocol endpoints are Chat Completions at /v1/chat/completions, Responses at /v1/responses, Messages at /v1/messages, and Gemini at /v1beta/models/{model}:generateContent.
Agent-First Error Recovery
Errors include fields that coding agents can parse without scraping docs:Supported API Families
Best Practices
API Key Safety
Use environment variables and server-side calls. Never expose keys in frontend code.
Check Non-Chat Requests
Read
/v1/models?recommended_for=... and /v1/models/:model before retrying image, video, music, 3D, translation, audio, embedding, or rerank requests.Smallest Runnable Example
Generate one working call before adding abstractions, queues, or UI flows.
Use Structured Hints
Parse
did_you_mean, retry_after, alternatives, and recommended_request before changing the code.FAQ
Skill not triggering automatically?
Skill not triggering automatically?
Mention “TokenLab” or “TokenLab API” in the request, for example:
Use TokenLab to add image generation to my Node.js app.Which coding agents are supported?
Which coding agents are supported?
Any coding agent that supports shared skill or rules directories can use the folder. The
skills installer handles supported agents automatically.How do I update the skill?
How do I update the skill?
Rerun the install command. It refreshes the local copy from the canonical public repository.
Resources
Agent-First API
Structured error hints and recovery behavior
API Documentation
Endpoint-specific setup and API reference
Models
Browse available models
llms.txt
Machine-readable API overview for agents
Questions? Use GitHub Issues or contact support@tokenlab.sh.