Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
aisbf
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
aisbf
Commits
f182fbd1
Commit
f182fbd1
authored
Apr 20, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All working but qwen-oauth2
parent
8b50a0ae
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
3945 additions
and
3030 deletions
+3945
-3030
package-lock.json
.kilo/package-lock.json
+115
-0
codex.py
aisbf/providers/codex.py
+100
-40
qwen.py
aisbf/providers/qwen.py
+73
-21
antani_sqlite_db_3f9c7e7f.sqlite3
antani_sqlite_db_3f9c7e7f.sqlite3
+0
-0
chatgpt-api-implementation-guide.md
chatgpt-api-implementation-guide.md
+1178
-1255
qwen-oauth2-analysis.md
qwen-oauth2-analysis.md
+2479
-1714
No files found.
.kilo/package-lock.json
0 → 100644
View file @
f182fbd1
{
"name"
:
".kilo"
,
"lockfileVersion"
:
3
,
"requires"
:
true
,
"packages"
:
{
""
:
{
"dependencies"
:
{
"@kilocode/plugin"
:
"7.2.14"
}
},
"node_modules/@kilocode/plugin"
:
{
"version"
:
"7.2.14"
,
"resolved"
:
"https://registry.npmjs.org/@kilocode/plugin/-/plugin-7.2.14.tgz"
,
"integrity"
:
"sha512-mS+WA9HZIBH2qQ9ARA+v0q4MdQTSdfOvKbe4AOSkjP+P5hVA70OM/UVM9DVcvmjSOxU+wuUxmOy+j/EQIrgFmw=="
,
"license"
:
"MIT"
,
"dependencies"
:
{
"@kilocode/sdk"
:
"7.2.14"
,
"zod"
:
"4.1.8"
},
"peerDependencies"
:
{
"@opentui/core"
:
">=0.1.97"
,
"@opentui/solid"
:
">=0.1.97"
},
"peerDependenciesMeta"
:
{
"@opentui/core"
:
{
"optional"
:
true
},
"@opentui/solid"
:
{
"optional"
:
true
}
}
},
"node_modules/@kilocode/sdk"
:
{
"version"
:
"7.2.14"
,
"resolved"
:
"https://registry.npmjs.org/@kilocode/sdk/-/sdk-7.2.14.tgz"
,
"integrity"
:
"sha512-Naz83lFrsbavuDp6UwxRuglOaSNvRBsZfcRNvb7RpWYAwbuJP0dBdhpXj6uO3ta5qxeQ2JzxKNC9Ffz+LCLLDg=="
,
"license"
:
"MIT"
,
"dependencies"
:
{
"cross-spawn"
:
"7.0.6"
}
},
"node_modules/cross-spawn"
:
{
"version"
:
"7.0.6"
,
"resolved"
:
"https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz"
,
"integrity"
:
"sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="
,
"license"
:
"MIT"
,
"dependencies"
:
{
"path-key"
:
"^3.1.0"
,
"shebang-command"
:
"^2.0.0"
,
"which"
:
"^2.0.1"
},
"engines"
:
{
"node"
:
">= 8"
}
},
"node_modules/isexe"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"
,
"integrity"
:
"sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
,
"license"
:
"ISC"
},
"node_modules/path-key"
:
{
"version"
:
"3.1.1"
,
"resolved"
:
"https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz"
,
"integrity"
:
"sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">=8"
}
},
"node_modules/shebang-command"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz"
,
"integrity"
:
"sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="
,
"license"
:
"MIT"
,
"dependencies"
:
{
"shebang-regex"
:
"^3.0.0"
},
"engines"
:
{
"node"
:
">=8"
}
},
"node_modules/shebang-regex"
:
{
"version"
:
"3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz"
,
"integrity"
:
"sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">=8"
}
},
"node_modules/which"
:
{
"version"
:
"2.0.2"
,
"resolved"
:
"https://registry.npmjs.org/which/-/which-2.0.2.tgz"
,
"integrity"
:
"sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="
,
"license"
:
"ISC"
,
"dependencies"
:
{
"isexe"
:
"^2.0.0"
},
"bin"
:
{
"node-which"
:
"bin/node-which"
},
"engines"
:
{
"node"
:
">= 8"
}
},
"node_modules/zod"
:
{
"version"
:
"4.1.8"
,
"license"
:
"MIT"
,
"funding"
:
{
"url"
:
"https://github.com/sponsors/colinhacks"
}
}
}
}
aisbf/providers/codex.py
View file @
f182fbd1
This diff is collapsed.
Click to expand it.
aisbf/providers/qwen.py
View file @
f182fbd1
...
...
@@ -25,6 +25,7 @@ import asyncio
import
time
import
json
import
platform
import
uuid
from
typing
import
Dict
,
List
,
Optional
,
Union
from
openai
import
AsyncOpenAI
from
..models
import
Model
...
...
@@ -130,19 +131,35 @@ class QwenProviderHandler(BaseProviderHandler):
logger
.
info
(
"QwenProviderHandler: Using OAuth2 authentication"
)
auth_key
=
access_token
# Use provider configured endpoint for OAuth2 (fixed endpoints)
base_url
=
self
.
provider_config
.
endpoint
# Get resource URL from auth and normalize it properly
base_url
=
self
.
auth
.
get_resource_url
()
# Normalize endpoint exactly as specified in documentation
if
not
base_url
.
startswith
(
"http"
):
base_url
=
f
"https://{base_url}"
if
not
base_url
.
endswith
(
"/v1"
):
base_url
=
f
"{base_url}/v1"
logger
.
info
(
f
"QwenProviderHandler: Final endpoint: {base_url}"
)
# Normalize endpoint
if
not
base_url
.
startswith
(
"http"
):
base_url
=
f
"https://{base_url}"
# DashScope endpoint already includes /v1 so do not append again
# Build required DashScope headers
import
uuid
user_agent
=
f
"QwenCode/1.0.0 ({platform.system().lower()}; {platform.machine()})"
default_headers
=
{
"Accept"
:
"application/json"
,
"X-DashScope-CacheControl"
:
"enable"
,
"X-DashScope-UserAgent"
:
user_agent
,
"X-DashScope-AuthType"
:
"qwen-oauth"
,
"x-request-id"
:
str
(
uuid
.
uuid4
()),
}
self
.
_sdk_client
=
AsyncOpenAI
(
api_key
=
auth_key
,
base_url
=
base_url
,
max_retries
=
3
,
timeout
=
httpx
.
Timeout
(
300.0
,
connect
=
30.0
),
default_headers
=
default_headers
,
)
logger
.
info
(
f
"QwenProviderHandler: Created SDK client (endpoint: {base_url})"
)
...
...
@@ -223,12 +240,22 @@ class QwenProviderHandler(BaseProviderHandler):
# Get SDK client with current OAuth token
client
=
await
self
.
_get_sdk_client
()
# Generate session tracking IDs
session_id
=
str
(
uuid
.
uuid4
())
prompt_id
=
str
(
uuid
.
uuid4
())
# Build request parameters
request_params
=
{
"model"
:
model
,
"messages"
:
messages
,
"max_tokens"
:
max_tokens
or
4096
,
"stream"
:
stream
,
"extra_body"
:
{
"metadata"
:
{
"sessionId"
:
session_id
,
"promptId"
:
prompt_id
}
}
}
if
temperature
is
not
None
and
temperature
>
0
:
...
...
@@ -240,6 +267,10 @@ class QwenProviderHandler(BaseProviderHandler):
if
tool_choice
and
tools
:
request_params
[
"tool_choice"
]
=
tool_choice
# Add stream_options for streaming requests
if
stream
:
request_params
[
"stream_options"
]
=
{
"include_usage"
:
True
}
try
:
if
stream
:
logger
.
info
(
"QwenProviderHandler: Using streaming mode"
)
...
...
@@ -440,16 +471,37 @@ class QwenProviderHandler(BaseProviderHandler):
using_api_key
=
qwen_config
and
isinstance
(
qwen_config
,
dict
)
and
qwen_config
.
get
(
'api_key'
)
if
not
using_api_key
:
# OAuth2 authentication: return f
ixed
model list
logger
.
info
(
"QwenProviderHandler: Using OAuth2 authentication, returning f
ixed
model list"
)
# OAuth2 authentication: return f
ull
model list
logger
.
info
(
"QwenProviderHandler: Using OAuth2 authentication, returning f
ull
model list"
)
return
[
Model
(
id
=
"
coder-model
"
,
name
=
"
Coder Model
"
,
id
=
"
qwen-turbo
"
,
name
=
"
Qwen Turbo
"
,
provider_id
=
self
.
provider_id
,
context_size
=
1000000
,
context_length
=
1000000
,
)
context_size
=
32000
,
context_length
=
32000
,
),
Model
(
id
=
"qwen-plus"
,
name
=
"Qwen Plus"
,
provider_id
=
self
.
provider_id
,
context_size
=
128000
,
context_length
=
128000
,
),
Model
(
id
=
"qwen-max"
,
name
=
"Qwen Max"
,
provider_id
=
self
.
provider_id
,
context_size
=
128000
,
context_length
=
128000
,
),
Model
(
id
=
"qwen3-coder-plus"
,
name
=
"Qwen 3 Coder Plus"
,
provider_id
=
self
.
provider_id
,
context_size
=
128000
,
context_length
=
128000
,
),
]
# API token authentication: fetch from models endpoint
...
...
@@ -502,10 +554,10 @@ class QwenProviderHandler(BaseProviderHandler):
# Fallback to static model list
logger
.
warning
(
"QwenProviderHandler: No models returned from API, using static list"
)
models
=
[
Model
(
id
=
"qwen-
plus"
,
name
=
"Qwen Plus
"
,
provider_id
=
self
.
provider_id
,
context_size
=
32000
),
Model
(
id
=
"qwen-
turbo"
,
name
=
"Qwen Turbo"
,
provider_id
=
self
.
provider_id
,
context_size
=
8000
),
Model
(
id
=
"qwen-max"
,
name
=
"Qwen Max"
,
provider_id
=
self
.
provider_id
,
context_size
=
8000
),
Model
(
id
=
"
coder-model"
,
name
=
"Qwen Coder"
,
provider_id
=
self
.
provider_id
,
context_size
=
32
000
),
Model
(
id
=
"qwen-
turbo"
,
name
=
"Qwen Turbo
"
,
provider_id
=
self
.
provider_id
,
context_size
=
32000
),
Model
(
id
=
"qwen-
plus"
,
name
=
"Qwen Plus"
,
provider_id
=
self
.
provider_id
,
context_size
=
12
8000
),
Model
(
id
=
"qwen-max"
,
name
=
"Qwen Max"
,
provider_id
=
self
.
provider_id
,
context_size
=
12
8000
),
Model
(
id
=
"
qwen3-coder-plus"
,
name
=
"Qwen 3 Coder Plus"
,
provider_id
=
self
.
provider_id
,
context_size
=
128
000
),
]
logger
.
info
(
f
"QwenProviderHandler: Returning {len(models)} models"
)
...
...
@@ -517,8 +569,8 @@ class QwenProviderHandler(BaseProviderHandler):
# Return static fallback list
logger
.
info
(
"QwenProviderHandler: Using static fallback model list"
)
return
[
Model
(
id
=
"qwen-
plus"
,
name
=
"Qwen Plus
"
,
provider_id
=
self
.
provider_id
,
context_size
=
32000
),
Model
(
id
=
"qwen-
turbo"
,
name
=
"Qwen Turbo"
,
provider_id
=
self
.
provider_id
,
context_size
=
8000
),
Model
(
id
=
"qwen-max"
,
name
=
"Qwen Max"
,
provider_id
=
self
.
provider_id
,
context_size
=
8000
),
Model
(
id
=
"
coder-model"
,
name
=
"Qwen Coder"
,
provider_id
=
self
.
provider_id
,
context_size
=
32
000
),
Model
(
id
=
"qwen-
turbo"
,
name
=
"Qwen Turbo
"
,
provider_id
=
self
.
provider_id
,
context_size
=
32000
),
Model
(
id
=
"qwen-
plus"
,
name
=
"Qwen Plus"
,
provider_id
=
self
.
provider_id
,
context_size
=
12
8000
),
Model
(
id
=
"qwen-max"
,
name
=
"Qwen Max"
,
provider_id
=
self
.
provider_id
,
context_size
=
12
8000
),
Model
(
id
=
"
qwen3-coder-plus"
,
name
=
"Qwen 3 Coder Plus"
,
provider_id
=
self
.
provider_id
,
context_size
=
128
000
),
]
antani_sqlite_db_3f9c7e7f.sqlite3
0 → 100644
View file @
f182fbd1
chatgpt-api-implementation-guide.md
View file @
f182fbd1
This diff is collapsed.
Click to expand it.
qwen-oauth2-analysis.md
View file @
f182fbd1
This diff is collapsed.
Click to expand it.
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