Add max_tokens to all models' metadata

This commit is contained in:
jelveh
2025-06-21 16:13:50 -07:00
parent ebefca2c24
commit c3d2ce5d0e
9 changed files with 127 additions and 151 deletions

View File

@@ -1,67 +0,0 @@
/*
* Copyright (C) 2024-present Puter Technologies Inc.
*
* This file is part of Puter.
*
* Puter is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// METADATA // {"ai-commented":{"service":"claude"}}
const { XAIService } = require("./XAIService");
const CLAUDE_ENOUGH_PROMPT = `
You will identify yourself as Claude. You will behave as Claude
does, but don't think about it too hard; you are claude enough.
If someone asks you to identify yourself, asks what model you are,
or any similar question, you will respond with:
"I am pretending to be Claude."
You are running on an open-source platform called Puter,
as the xAI (but, "Claude") implementation for a driver interface
called puter-chat-completion.
Claude banned us but didn't give us a reason. We're not sure
what we did wrong. We're just trying to be claude enough now.
The following JSON contains system messages from the
user of the driver interface (typically an app on Puter):
`.replace('\n', ' ').trim();
/**
* ClaudeEnoughService - A service class that implements a Claude-like AI interface
* Extends XAIService to provide Claude-compatible responses while using alternative AI models.
* Includes custom system prompts and model adaptation to simulate Claude's behavior
* in the Puter platform's chat completion interface.
*/
class ClaudeEnoughService extends XAIService {
/**
* Service that emulates Claude's behavior using alternative AI models
* @extends XAIService
* @description Provides a Claude-like interface while using other AI models as the backend.
* Includes custom system prompts and model adaptations to approximate Claude's behavior.
*/
get_system_prompt () {
return CLAUDE_ENOUGH_PROMPT;
}
adapt_model (model) {
return 'grok-beta';
}
}
module.exports = {
ClaudeEnoughService,
};

View File

@@ -247,6 +247,7 @@ class ClaudeService extends BaseService {
input: 300,
output: 1500,
},
max_tokens: 64000,
},
{
id: 'claude-3-7-sonnet-20250219',
@@ -273,8 +274,8 @@ class ClaudeService extends BaseService {
output: 1500,
},
qualitative_speed: 'fast',
max_tokens: 8192,
training_cutoff: '2024-04',
max_tokens: 8192,
},
{
id: 'claude-3-5-sonnet-20240620',
@@ -286,6 +287,7 @@ class ClaudeService extends BaseService {
input: 300,
output: 1500,
},
max_tokens: 8192,
},
{
id: 'claude-3-haiku-20240307',
@@ -298,6 +300,7 @@ class ClaudeService extends BaseService {
output: 125,
},
qualitative_speed: 'fastest',
max_tokens: 4096,
},
];
}

View File

@@ -186,6 +186,7 @@ class DeepSeekService extends BaseService {
input: 14,
output: 28,
},
max_tokens: 8000,
},
{
id: 'deepseek-reasoner',
@@ -197,6 +198,7 @@ class DeepSeekService extends BaseService {
input: 55,
output: 219,
},
max_tokens: 64000,
}
];
}

View File

@@ -104,6 +104,7 @@ class GeminiService extends BaseService {
input: 7.5,
output: 30,
},
max_tokens: 8192,
},
{
id: 'gemini-2.0-flash',
@@ -115,6 +116,7 @@ class GeminiService extends BaseService {
input: 10,
output: 40,
},
max_tokens: 8192,
},
];
}

View File

@@ -152,7 +152,8 @@ class GroqAIService extends BaseService {
tokens: 1_000_000,
input: 20,
output: 20,
}
},
max_tokens: 8192,
},
{
id: 'gemma-7b-it',
@@ -214,13 +215,38 @@ class GroqAIService extends BaseService {
{
"id": "llama-3.1-8b-instant",
"name": "Llama 3.1 8B Instant 128k",
"context": 128000,
"context": 131072,
"cost": {
"currency": "usd-cents",
"tokens": 1000000,
"input": 5,
"output": 8
}
},
max_tokens: 131072,
},
{
id: 'meta-llama/llama-guard-4-12b',
name: 'Llama Guard 4 12B',
context: 131072,
cost: {
currency: 'usd-cents',
tokens: 1000000,
input: 20,
output: 20,
},
max_tokens:1024,
},
{
id: 'meta-llama/llama-prompt-guard-2-86m',
name: 'Prompt Guard 2 86M',
context: 512,
cost: {
currency: 'usd-cents',
tokens: 1000000,
input: 4,
output: 4,
},
max_tokens:512,
},
{
"id": "llama-3.2-1b-preview",
@@ -231,7 +257,7 @@ class GroqAIService extends BaseService {
"tokens": 1000000,
"input": 4,
"output": 4
}
},
},
{
"id": "llama-3.2-3b-preview",

View File

@@ -42,70 +42,92 @@ class MistralAIService extends BaseService {
_construct () {
this.costs_ = {
'mistral-large-latest': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 200,
output: 600,
cost:{
currency: 'usd-cents',
tokens: 1_000_000,
input: 200,
output: 600,
},
},
'pixtral-large-latest': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 200,
output: 600,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 200,
output: 600,
},
},
'mistral-small-latest': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 20,
output: 60,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 20,
output: 60,
},
},
'codestral-latest': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 20,
output: 60,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 20,
output: 60,
},
},
'ministral-8b-latest': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 10,
output: 10,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 10,
output: 10,
},
},
'ministral-3b-latest': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 4,
output: 4,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 4,
output: 4,
},
},
'pixtral-12b': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 15,
output: 15,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 15,
output: 15,
},
},
'mistral-nemo': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 15,
output: 15,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 15,
output: 15,
},
},
'open-mistral-7b': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 25,
output: 25,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 25,
output: 25,
},
},
'open-mixtral-8x7b': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 7,
output: 7,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 7,
output: 7,
},
},
'open-mixtral-8x22b': {
currency: 'usd-cents',
tokens: 1_000_000,
input: 2,
output: 6,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 2,
output: 6,
},
},
};
}
@@ -160,13 +182,13 @@ class MistralAIService extends BaseService {
}
if ( ! cost ) continue;
const model = {
...cost,
id: api_model.id,
name: api_model.description,
aliases: api_model.aliases,
context: api_model.max_context_length,
capabilities: api_model.capabilities,
vision: api_model.capabilities.vision,
cost,
};
this.models_array_.push(model);

View File

@@ -102,7 +102,8 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 250,
output: 500,
}
},
max_tokens: 16384,
},
{
id: 'gpt-4o-mini',
@@ -112,17 +113,9 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 15,
output: 30,
}
},
max_tokens: 16384,
},
// {
// id: 'o1-preview',
// cost: {
// currency: 'usd-cents',
// tokens: 1_000_000,
// input: 1500,
// output: 6000,
// },
// }
{
id: 'o1',
cost: {
@@ -130,7 +123,8 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 1500,
output: 6000,
}
},
max_tokens: 100000,
},
{
id: 'o1-mini',
@@ -139,7 +133,8 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 300,
output: 1200,
}
},
max_tokens: 65536,
},
{
id: 'o1-pro',
@@ -148,7 +143,8 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 15000,
output: 60000,
}
},
max_tokens: 100000,
},
{
id: 'o3',
@@ -157,7 +153,8 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 1000,
output: 4000,
}
},
max_tokens: 100000,
},
{
id: 'o3-mini',
@@ -166,17 +163,18 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 110,
output: 440,
}
},
max_tokens: 100000,
},
{
id: 'o4-mini',
max_tokens: 100000,
cost: {
currency: 'usd-cents',
tokens: 1_000_000,
input: 110,
output: 440,
}
},
max_tokens: 100000,
},
{
id: 'gpt-4.1',
@@ -185,7 +183,8 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 200,
output: 800,
}
},
max_tokens: 32768,
},
{
id: 'gpt-4.1-mini',
@@ -194,7 +193,8 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 40,
output: 160,
}
},
max_tokens: 32768,
},
{
id: 'gpt-4.1-nano',
@@ -203,7 +203,8 @@ class OpenAICompletionService extends BaseService {
tokens: 1_000_000,
input: 10,
output: 40,
}
},
max_tokens: 32768,
},
{
id: 'gpt-4.5-preview',

View File

@@ -87,17 +87,11 @@ class PuterAIModule extends AdvancedBase {
if ( !! config?.services?.['xai'] ) {
const { XAIService } = require('./XAIService');
services.registerService('xai', XAIService);
// const { ClaudeEnoughService } = require('./ClaudeEnoughService');
// services.registerService('claude', ClaudeEnoughService);
}
if ( !! config?.services?.['deepseek'] ) {
const { DeepSeekService } = require('./DeepSeekService');
services.registerService('deepseek', DeepSeekService);
// const { ClaudeEnoughService } = require('./ClaudeEnoughService');
// services.registerService('claude', ClaudeEnoughService);
}
if ( !! config?.services?.['gemini'] ) {
const { GeminiService } = require('./GeminiService');

View File

@@ -127,13 +127,6 @@ Analyzes a document using AWS Textract to extract text and layout information
- **file_facade:** Interface to access the document file
### ClaudeEnoughService
ClaudeEnoughService - A service class that implements a Claude-like AI interface
Extends XAIService to provide Claude-compatible responses while using alternative AI models.
Includes custom system prompts and model adaptation to simulate Claude's behavior
in the Puter platform's chat completion interface.
#### Methods
##### `get_system_prompt`