Skip to content

Commit 0a0977a

Browse files
committed
feat(new tool): GPT Token Encoder/Decoder
Fix CorentinTh#1109, CorentinTh#1334
1 parent c031d57 commit 0a0977a

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { FileText } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'GPT Token Encoder/Decoder',
6+
path: '/gpt-token-encoder',
7+
description: 'Encode text to GPT tokens and decode GPT tokens back to text',
8+
keywords: ['gpt', 'llm', 'openai', 'token', 'encode', 'decode'],
9+
component: () => import('./gpt-token-encoder.vue'),
10+
icon: FileText,
11+
createdAt: new Date('2025-08-15'),
12+
category: 'Text',
13+
});

src/tools/gpt-token-estimator/gpt-token-estimator.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useI18n } from 'vue-i18n';
33
import JSON5 from 'json5';
44
import type { TiktokenModel } from 'js-tiktoken';
55
import { GPTTokens } from './gpt-tokens.service';
6-
import TextareaCopyable from '@/components/TextareaCopyable.vue';
76
import { useValidation } from '@/composable/validation';
87
import { useQueryParamOrStorage } from '@/composable/queryParams';
98
@@ -162,6 +161,12 @@ const outputTokenCosts = computed(() => {
162161
<n-form-item :label="t('tools.gpt-token-estimator.texts.label-completion-tokens')" label-placement="left">
163162
<InputCopyable :value="outputTokenCosts.completionUsedTokens" />
164163
</n-form-item>
164+
165+
<n-p mt-3>
166+
<n-a href="https://platform.openai.com/docs/pricing" target="_blank">
167+
See OpenAPI Pricings
168+
</n-a>
169+
</n-p>
165170
</div>
166171
</div>
167172
</template>

0 commit comments

Comments
 (0)