feat: sync Node SDK with Python SDK (gateway client, agent mode, fine-tuning listModels) - #166
feat: sync Node SDK with Python SDK (gateway client, agent mode, fine-tuning listModels)#166devin-ai-integration[bot] wants to merge 2 commits into
mode, fine-tuning listModels)#166Conversation
…-tuning listModels)
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| constructor(client: Client, baseURL?: string) { | ||
| this.client = client; | ||
| this._baseURL = | ||
| baseURL ?? | ||
| (typeof process !== "undefined" ? process.env.VLMRUN_GATEWAY_URL : undefined) ?? | ||
| DEFAULT_GATEWAY_URL; | ||
| } |
There was a problem hiding this comment.
🟨 API key sent to an environment-controlled gateway URL without scheme validation
The gateway base URL is taken from the VLMRUN_GATEWAY_URL environment variable (or a caller-supplied override) with no validation, and the API key is then attached as a bearer token both to the OpenAI client (src/client/gateway.ts:94-99) and to the raw health probe (src/client/gateway.ts:185-187). If the variable points at a plain-HTTP or attacker-controlled host, the credential is transmitted to that endpoint in cleartext / to an unintended destination.
Was this helpful? React with 👍 or 👎 to provide feedback.
Runtime testing — gateway, agent
|
Summary
Brings the Node SDK back in line with the Python SDK, which has moved ahead since the last sync (node #157 ≈ python #199). Four gaps closed:
1.
client.gateway(mirrors pythonvlmrun/client/gateway.py, #203) — newGatewayresource pointing the OpenAI SDK at{gatewayURL}/openaifor third-party OCR / VLM models:Timeout follows the Python rule: only raise the floor to 600s when the caller is still at the client default (120s); an explicit timeout is left alone.
openaistays an optional peer dep — a missing install throwsDependencyError, same asclient.agent. Exposed asclient.gatewaywith a newgatewayURLoption onVlmRunConfig.2.
AgentExecutionConfig.mode(python #205):"agent" | "program" | null, serialized asmode. Orion-2 only.3.
finetuning.listModels({skip, limit})→GET models, returningstring[](pythonFinetuning.list_models).4. Agent completions timeout floor (python #194):
client.agent.completionsnow usesmax(client.timeout ?? 600s, 600s)instead of passing the client timeout straight through — long agent runs were timing out at the 120s default. Two existing unit tests asserted the passthrough and were updated to the new behavior.Also: gateway unit tests, README "Model Gateway" section, version bump to 1.4.0 (release-on-merge keys off the
package.jsonversion).Not ported:
skills.create_from_directory()/AgentSkill.from_directory(), which need a zip writer (the Node SDK only has a tar helper today) — left as a follow-up rather than pulling in a new dependency here.Link to Devin session: https://app.devin.ai/sessions/d65d2dd4f01c492cad8ed440f922079e