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 GONKAROUTER: string = 'gonkarouter';

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

export const CONTENT_TYPES = {
Expand Down
24 changes: 24 additions & 0 deletions src/providers/gonkarouter/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ProviderAPIConfig } from '../types';

export const GonkaRouterAPIConfig: ProviderAPIConfig = {
getBaseURL: () => `https://api.gonkarouter.io/v1`,
headers({ providerOptions }) {
const { apiKey } = providerOptions;
const headers = {
Authorization: `Bearer ${apiKey}`,
};
return headers;
},
getEndpoint({ fn }) {
switch (fn) {
case 'chatComplete': {
return '/chat/completions';
}
case 'complete': {
return '/completions';
}
default:
return '';
}
},
};
21 changes: 21 additions & 0 deletions src/providers/gonkarouter/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { GONKAROUTER } from '../../globals';
import {
chatCompleteParams,
completeParams,
responseTransformers,
} from '../open-ai-base';
import { ProviderConfigs } from '../types';
import { GonkaRouterAPIConfig } from './api';

export const GonkaRouterProviderConfig: ProviderConfigs = {
// Pure pass-through: do not bake in a default model. Clear the inherited
// OpenAI base default ('gpt-3.5-turbo') so an omitted model surfaces a clean
// "model required" error from GonkaRouter instead of routing to a phantom model.
chatComplete: chatCompleteParams([], { model: undefined }),
complete: completeParams([]),
api: GonkaRouterAPIConfig,
responseTransforms: responseTransformers(GONKAROUTER, {
chatComplete: true,
complete: true,
}),
};
3 changes: 3 additions & 0 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ import OracleConfig from './oracle';
import IOIntelligenceConfig from './iointelligence';
import AIBadgrConfig from './aibadgr';
import OVHcloudConfig from './ovhcloud';
import { GONKAROUTER } from '../globals';
import { GonkaRouterProviderConfig } from './gonkarouter';

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

export default Providers;