Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
b505de59
Commit
b505de59
authored
Mar 16, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix provider handle
parent
ca91d563
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
litellm.py
codai/openai/litellm.py
+5
-12
No files found.
codai/openai/litellm.py
View file @
b505de59
...
@@ -13,13 +13,6 @@ from typing import List, Dict, Any, Optional, AsyncGenerator, Union
...
@@ -13,13 +13,6 @@ from typing import List, Dict, Any, Optional, AsyncGenerator, Union
try
:
try
:
import
litellm
import
litellm
# Register 'coderai' as an alias for the 'openai' provider
# This allows LiteLLM to use its internal HTTP handler for custom providers
# by mapping them to the 'openai' provider behavior
litellm
.
custom_provider_map
=
[
{
"provider"
:
"coderai"
,
"custom_handler"
:
litellm
.
openai
}
]
# Register 'coderai' as an alias for the 'openai' provider
# Register 'coderai' as an alias for the 'openai' provider
# This allows LiteLLM to use its internal HTTP handler for custom providers
# This allows LiteLLM to use its internal HTTP handler for custom providers
# by mapping them to the 'openai' provider behavior
# by mapping them to the 'openai' provider behavior
...
@@ -135,7 +128,7 @@ class LiteLLMBackend:
...
@@ -135,7 +128,7 @@ class LiteLLMBackend:
# Known litellm providers
# Known litellm providers
known_providers
=
[
'openai'
,
'anthropic'
,
'gemini'
,
'meta'
,
'mistral'
,
'cohere'
,
known_providers
=
[
'openai'
,
'anthropic'
,
'gemini'
,
'meta'
,
'mistral'
,
'cohere'
,
'ai21'
,
'bedrock'
,
'azure'
,
'ollama'
,
'huggingface'
,
'deepseek'
,
'ai21'
,
'bedrock'
,
'azure'
,
'ollama'
,
'huggingface'
,
'deepseek'
,
'qwen'
,
'sagemaker'
,
'vertex'
,
'aiplatform'
,
'vllm'
,
'tgi'
]
'qwen'
,
'sagemaker'
,
'vertex'
,
'aiplatform'
,
'vllm'
,
'tgi'
,
'coderai'
]
# Check if there's an existing provider prefix (contains /)
# Check if there's an existing provider prefix (contains /)
if
'/'
in
resolved_model
:
if
'/'
in
resolved_model
:
...
@@ -144,14 +137,14 @@ class LiteLLMBackend:
...
@@ -144,14 +137,14 @@ class LiteLLMBackend:
if
prefix
in
known_providers
:
if
prefix
in
known_providers
:
# Valid provider, reformat as openai/{provider}/{model}
# Valid provider, reformat as openai/{provider}/{model}
model_part
=
'/'
.
join
(
parts
[
1
:])
model_part
=
'/'
.
join
(
parts
[
1
:])
result
=
f
"
open
ai/{prefix}/{model_part}"
result
=
f
"
coder
ai/{prefix}/{model_part}"
print
(
f
"DEBUG litellm: Known provider '{prefix}', returning: {result}"
)
print
(
f
"DEBUG litellm: Known provider '{prefix}', returning: {result}"
)
return
result
return
result
# Otherwise, treat the first part as the org/provider name (not default to huggingface)
# Otherwise, treat the first part as the org/provider name (not default to huggingface)
# This allows custom model paths like TeichAI/model-name to work correctly
# This allows custom model paths like TeichAI/model-name to work correctly
org_name
=
parts
[
0
]
org_name
=
parts
[
0
]
model_part
=
'/'
.
join
(
parts
[
1
:])
model_part
=
'/'
.
join
(
parts
[
1
:])
result
=
f
"
open
ai/{org_name}/{model_part}"
result
=
f
"
coder
ai/{org_name}/{model_part}"
print
(
f
"DEBUG litellm: Custom org/model, returning: {result}"
)
print
(
f
"DEBUG litellm: Custom org/model, returning: {result}"
)
return
result
return
result
...
@@ -195,12 +188,12 @@ class LiteLLMBackend:
...
@@ -195,12 +188,12 @@ class LiteLLMBackend:
# Check for known patterns
# Check for known patterns
for
pattern
,
provider
in
provider_map
.
items
():
for
pattern
,
provider
in
provider_map
.
items
():
if
model_lower
.
startswith
(
pattern
):
if
model_lower
.
startswith
(
pattern
):
result
=
f
"
open
ai/{provider}/{resolved_model}"
result
=
f
"
coder
ai/{provider}/{resolved_model}"
print
(
f
"DEBUG litellm: Detected provider '{provider}', returning: {result}"
)
print
(
f
"DEBUG litellm: Detected provider '{provider}', returning: {result}"
)
return
result
return
result
# Default: use "coderai" as provider for unknown models
# Default: use "coderai" as provider for unknown models
result
=
f
"
open
ai/coderai/{resolved_model}"
result
=
f
"
coder
ai/coderai/{resolved_model}"
print
(
f
"DEBUG litellm: Unknown provider, using 'coderai', returning: {result}"
)
print
(
f
"DEBUG litellm: Unknown provider, using 'coderai', returning: {result}"
)
return
result
return
result
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment