The way to solve "The parameter tool.type" error when use custom model in codex sdk
#30681
ziJinChampion
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Yesterday I tried to use Doubao-seed-pro in code sdk, but after I set up baseUrl and apiKey I got {"type":"error","message":"{"error":{"code":"InvalidParameter","message":"The parameter
tool.typespecified in the request are not valid:The parametertypespecified in the request are not valid: unknown tool type: custom.. Request id: "xxx"","param":"tool.type","type":"BadRequest"}}"}.At first I thought Doubao is not compatible with Codex, but when I use Doubao with codex cli, it works.
So I want to know why cli works fine but sdk can not work properly.
After extract request logs and find the difference i found each requests has header: 'originator' .
When you post a request via codex cli it is 'codex_exec', via codex sdk it is 'codex_sdk_ts'. That is the only difference.
So you just need to set the env as : CODEX_INTERNAL_ORIGINATOR_OVERRIDE: "codex_exec".
This is the whole configuration:
const codex = new Codex({ config: { model_provider: "volcengine-ark", model_providers: { "volcengine-ark": { name: "Volcengine Ark", base_url: "https://ark.cn-beijing.volces.com/api/v3", env_key: "ARK_API_KEY", wire_api: "responses", }, } }, env: { ...process.env, ARK_API_KEY: process.env.ARK_API_KEY!, CODEX_INTERNAL_ORIGINATOR_OVERRIDE: "codex_exec", }, });Beta Was this translation helpful? Give feedback.
All reactions