api.ts from Portkey-AI/gateway
// Source: https://github.com/Portkey-AI/gateway | License: MIT | Copyright 2024 Portkey, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { ProviderAPIConfig } from '../types';
const CohereAPIConfig: ProviderAPIConfig = {
getBaseURL: () => 'https://api.cohere.ai',
headers: ({ providerOptions, fn }) => {
const headers: Record<string, string> = {
Authorization: `Bearer ${providerOptions.apiKey}`,
};
if (fn === 'uploadFile') {
headers['Content-Type'] = 'multipart/form-data';
}
return headers;
},
getEndpoint: ({ fn, gatewayRequestURL }) => {
switch (fn) {
case 'chatComplete':
return '/v2/chat';
case 'complete':
return '/v1/generate';
case 'embed':
return '/v2/embed';
case 'u
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key