Skip to content

Commit 4851bd3

Browse files
authored
Merge pull request #1331 from MarcNB256/provider/nextbit
provider: add NextBit (OpenAI-compatible /chat/completions, /completi…
2 parents f905456 + 3591dd5 commit 4851bd3

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

src/globals.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const QDRANT: string = 'qdrant';
104104
export const THREE_ZERO_TWO_AI: string = '302ai';
105105
export const MESHY: string = 'meshy';
106106
export const TRIPO3D: string = 'tripo3d';
107+
export const NEXTBIT: string = 'nextbit';
107108

108109
export const VALID_PROVIDERS = [
109110
ANTHROPIC,
@@ -171,6 +172,7 @@ export const VALID_PROVIDERS = [
171172
THREE_ZERO_TWO_AI,
172173
MESHY,
173174
TRIPO3D,
175+
NEXTBIT,
174176
];
175177

176178
export const CONTENT_TYPES = {

src/providers/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import KrutrimConfig from './krutrim';
6565
import AI302Config from './302ai';
6666
import MeshyConfig from './meshy';
6767
import Tripo3DConfig from './tripo3d';
68+
import { NextBitConfig } from './nextbit';
6869

6970
const Providers: { [key: string]: ProviderConfigs } = {
7071
openai: OpenAIConfig,
@@ -129,6 +130,7 @@ const Providers: { [key: string]: ProviderConfigs } = {
129130
krutrim: KrutrimConfig,
130131
'302ai': AI302Config,
131132
meshy: MeshyConfig,
133+
nextbit: NextBitConfig,
132134
tripo3d: Tripo3DConfig,
133135
};
134136

src/providers/nextbit/api.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { ProviderAPIConfig } from '../types';
2+
3+
export const nextBitAPIConfig: ProviderAPIConfig = {
4+
getBaseURL: () => 'https://api.nextbit256.com/v1',
5+
headers({ providerOptions }) {
6+
const { apiKey } = providerOptions;
7+
return { Authorization: `Bearer ${apiKey}` };
8+
},
9+
getEndpoint({ fn }) {
10+
switch (fn) {
11+
case 'chatComplete':
12+
return '/chat/completions';
13+
case 'complete':
14+
return '/completions';
15+
default:
16+
return '';
17+
}
18+
},
19+
};

src/providers/nextbit/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { NEXTBIT } from '../../globals';
2+
import {
3+
chatCompleteParams,
4+
completeParams,
5+
responseTransformers,
6+
} from '../open-ai-base';
7+
import { ProviderConfigs } from '../types';
8+
import { nextBitAPIConfig } from './api';
9+
10+
export const NextBitConfig: ProviderConfigs = {
11+
chatComplete: chatCompleteParams([], { model: 'microsoft:phi-4' }),
12+
complete: completeParams([], { model: 'microsoft:phi-4' }),
13+
api: nextBitAPIConfig,
14+
responseTransforms: responseTransformers(NEXTBIT, {
15+
chatComplete: true,
16+
complete: true,
17+
}),
18+
};

0 commit comments

Comments
 (0)