providers: add teamorouter; pick the first /models id when no default model
This commit is contained in:
@@ -11,6 +11,9 @@ static const cst_provider_t PROVIDERS[] = {
|
||||
{"deepseek", "https://api.deepseek.com/v1", "deepseek-flash",
|
||||
"DEEPSEEK_API_KEY"},
|
||||
{"openai", "https://api.openai.com/v1", "gpt-4.1-mini", "OPENAI_API_KEY"},
|
||||
/* Router: no fixed model; the first id from GET /models is picked. */
|
||||
{"teamorouter", "https://api.teamorouter.com/v1", "",
|
||||
"TEAMOROUTER_API_KEY"},
|
||||
};
|
||||
|
||||
const cst_provider_t *cst_provider_find(const char *name) {
|
||||
@@ -102,6 +105,10 @@ long cst_model_context_tokens(const char *model) {
|
||||
{"o3", 200000}, {"o4", 200000}, {"claude", 200000},
|
||||
{"qwen", 131072}, {"glm", 128000}, {"kimi", 131072}};
|
||||
if (model) {
|
||||
/* routers name models "vendor/model" */
|
||||
const char *slash = strrchr(model, '/');
|
||||
if (slash && slash[1])
|
||||
model = slash + 1;
|
||||
for (size_t i = 0; i < sizeof(T) / sizeof(T[0]); i++) {
|
||||
if (strncmp(model, T[i].prefix, strlen(T[i].prefix)) == 0)
|
||||
return T[i].tokens;
|
||||
|
||||
Reference in New Issue
Block a user