Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const ORACLE: string = 'oracle';
export const IO_INTELLIGENCE: string = 'iointelligence';
export const AIBADGR: string = 'aibadgr';
export const OVHCLOUD: string = 'ovhcloud';
export const TOKENLAB: string = 'tokenlab';

export const VALID_PROVIDERS = [
ANTHROPIC,
Expand Down Expand Up @@ -189,6 +190,7 @@ export const VALID_PROVIDERS = [
IO_INTELLIGENCE,
AIBADGR,
OVHCLOUD,
TOKENLAB,
];

export const CONTENT_TYPES = {
Expand Down
2 changes: 2 additions & 0 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import OracleConfig from './oracle';
import IOIntelligenceConfig from './iointelligence';
import AIBadgrConfig from './aibadgr';
import OVHcloudConfig from './ovhcloud';
import TokenLabConfig from './tokenlab';

const Providers: { [key: string]: ProviderConfigs } = {
openai: OpenAIConfig,
Expand Down Expand Up @@ -148,6 +149,7 @@ const Providers: { [key: string]: ProviderConfigs } = {
iointelligence: IOIntelligenceConfig,
aibadgr: AIBadgrConfig,
ovhcloud: OVHcloudConfig,
tokenlab: TokenLabConfig,
};

export default Providers;
24 changes: 24 additions & 0 deletions src/providers/tokenlab/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ProviderAPIConfig } from '../types';

const TokenLabAPIConfig: ProviderAPIConfig = {
getBaseURL: () => 'https://api.tokenlab.sh/v1',
headers: ({ providerOptions }) => ({
Authorization: `Bearer ${providerOptions.apiKey}`,
}),
getEndpoint: ({ fn, gatewayRequestURL }) => {
const basePath = gatewayRequestURL.split('/v1')?.[1];
switch (fn) {
case 'chatComplete':
return '/chat/completions';
case 'createModelResponse':
case 'getModelResponse':
case 'deleteModelResponse':
case 'listResponseInputItems':
return basePath;
default:
return '';
}
},
};

export default TokenLabAPIConfig;
30 changes: 30 additions & 0 deletions src/providers/tokenlab/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { TOKENLAB } from '../../globals';
import {
chatCompleteParams,
createModelResponseParams,
OpenAICreateModelResponseTransformer,
OpenAIDeleteModelResponseTransformer,
OpenAIGetModelResponseTransformer,
OpenAIListInputItemsResponseTransformer,
responseTransformers,
} from '../open-ai-base';
import { ProviderConfigs } from '../types';
import TokenLabAPIConfig from './api';

const TokenLabConfig: ProviderConfigs = {
api: TokenLabAPIConfig,
chatComplete: chatCompleteParams([], { model: 'gpt-5.4-mini' }),
createModelResponse: createModelResponseParams([]),
getModelResponse: {},
deleteModelResponse: {},
listResponseInputItems: {},
responseTransforms: {
...responseTransformers(TOKENLAB, { chatComplete: true }),
createModelResponse: OpenAICreateModelResponseTransformer(TOKENLAB),
getModelResponse: OpenAIGetModelResponseTransformer(TOKENLAB),
deleteModelResponse: OpenAIDeleteModelResponseTransformer(TOKENLAB),
listResponseInputItems: OpenAIListInputItemsResponseTransformer(TOKENLAB),
},
};

export default TokenLabConfig;
4 changes: 4 additions & 0 deletions src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,7 @@ <h3>Select Provider</h3>
<option value="perplexity-ai">Perplexity AI</option>
<option value="mistral-ai">Mistral AI</option>
<option value="bytez">Bytez</option>
<option value="tokenlab">TokenLab</option>
<option value="others">Others</option>
</select>
</div>
Expand Down Expand Up @@ -1533,6 +1534,7 @@ <h3>Enter API Key</h3>
"perplexity-ai": "pplx-7b-online",
"mistral-ai": "mistral-small-latest",
"bytez": "google/gemma-3-1b-it",
"tokenlab": "gpt-5.4-mini",
"others": "gpt-4o-mini"
}

Expand All @@ -1546,6 +1548,7 @@ <h3>Enter API Key</h3>
"together-ai": "https://portkey.ai/docs/integrations/llms/together-ai",
"perplexity-ai": "https://portkey.ai/docs/integrations/llms/perplexity-ai",
"mistral-ai": "https://portkey.ai/docs/integrations/llms/mistral-ai",
"tokenlab": "https://docs.tokenlab.sh/",
"others": "https://portkey.ai/docs/integrations/llms"
}

Expand Down Expand Up @@ -1879,6 +1882,7 @@ <h3>Enter API Key</h3>
case 'openai':
case 'anthropic':
case 'groq':
case 'tokenlab':
return [{ id: 'apiKey', placeholder: 'Enter your API key' }];
case 'azure-openai':
return [
Expand Down