# Client setup · OpenCode and tools — neuraldeep.tech API

> One section of the machine-readable reference. All sections: https://neuraldeep.tech/llms.txt · everything in one file: https://neuraldeep.tech/llms-full.txt

Base URL: `https://api.neuraldeep.tech/v1`
Auth: `Authorization: Bearer $YOUR_KEY`

#### First client launch

Check the key and API first, then configure the client. After a successful request, move on to [agent tuning](https://neuraldeep.tech/docs/agent-config.md). Client examples follow below in this section.

##### Key, endpoint and model

Open the [dashboard](https://hub.neuraldeep.tech/app), go to "Keys", and create or copy your own API key. The base URL for an OpenAI-compatible client is `https://api.neuraldeep.tech/v1`, with one `/v1` suffix. Keep the key out of git, logs and screenshots.

Take the exact model identifier from `data[].id` in an authenticated `GET /v1/models` response. The API expects a raw model name such as `qwen3.6-35b-a3b`, without a provider prefix. The effective context window depends on the key, so a public model table is not enough. A model in this list is not necessarily callable with your key: pay-per-token models are listed for a key in Plan mode too. The short request below is the final access check.

##### Environment variable

Paste the whole block for your shell and press Enter, then type the key at the hidden prompt. This keeps the key out of your command history. The braces, and `& { }` in PowerShell, make the shell read the whole block before asking for the key, so keep them. Without them, a terminal that pastes line by line feeds the next line of the block into the variable instead of the key, and the key you type next runs as a command and lands in the history.

```bash
{
  printf 'NeuralDeep API key: '
  IFS= read -rs NEURALDEEP_API_KEY
  printf '\n'
  export NEURALDEEP_API_KEY
  test -n "$NEURALDEEP_API_KEY" && printf 'NEURALDEEP_API_KEY is set\n'
}
```

```powershell
& {
  $secret = Read-Host 'NeuralDeep API key' -AsSecureString
  $env:NEURALDEEP_API_KEY = [System.Net.NetworkCredential]::new('', $secret).Password
  -not [string]::IsNullOrWhiteSpace($env:NEURALDEEP_API_KEY)
}
```

The check prints `NEURALDEEP_API_KEY is set` in bash/zsh or `True` in PowerShell, without printing the key. The variable belongs to this terminal and processes launched from it. Launch the client from this terminal. For a GUI application, set the variable in its launch environment and restart the application. A `.env` file alone does not export variables into a process.

##### Verify the API before configuring the client

Run these requests in bash/zsh. The first prints the response status and the Qwen 3.6 models it found: expect `HTTP/2 200` or `HTTP/1.1 200` and lines with `qwen3.6-35b-a3b` and `qwen3.6-35b-a3b-noreason`. On any other status, repeat the request without `| grep ...` to see the error text.

```bash
curl --silent --show-error --include https://api.neuraldeep.tech/v1/models \
  -H "Authorization: Bearer $NEURALDEEP_API_KEY" \
  | grep -o -E '^HTTP/[0-9.]+ [0-9]+|"id": "qwen3[.]6-35b-a3b[^"]*"'

curl --silent --show-error --include https://api.neuraldeep.tech/v1/chat/completions \
  -H "Authorization: Bearer $NEURALDEEP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen3.6-35b-a3b-noreason","messages":[{"role":"user","content":"Reply with OK."}],"max_tokens":64}'
```

In PowerShell, use this separate block rather than bash line continuations and curl quoting.

```powershell
$headers = @{ Authorization = "Bearer $env:NEURALDEEP_API_KEY" }
$models = Invoke-RestMethod -Uri 'https://api.neuraldeep.tech/v1/models' -Headers $headers
$models.data | Select-Object id, limit

$body = @{
  model = 'qwen3.6-35b-a3b-noreason'
  messages = @(@{ role = 'user'; content = 'Reply with OK.' })
  max_tokens = 64
} | ConvertTo-Json -Depth 4
$reply = Invoke-RestMethod -Method Post -Uri 'https://api.neuraldeep.tech/v1/chat/completions' -Headers $headers -ContentType 'application/json' -Body $body
$reply.choices[0].message.content
```

A successful chat request returns HTTP 200 and a short answer in `choices[0].message.content`, usually `OK`. It consumes quota or key balance like any other request. If it fails, resolve the HTTP error before changing the client config.

##### After the first response

The [agent settings builder](https://neuraldeep.tech/docs/agent-config.md) uses live limits from `GET /api/public/tier-limits`. Choose the client and locate its configuration file first. OpenCode gets a complete config with a main model, a helper model and credentials from the environment; other profiles may be fragments for an existing file. Back up the file and merge only the keys you need, keeping other providers. Not every displayed number is represented in every client's config; pacing, concurrency and retry support depend on the client and version.

#### Tool calling

Standard OpenAI tool-calling via `tools` + `tool_choice`. The model decides when to call a tool and returns JSON with the arguments.

```python
from openai import OpenAI
client = OpenAI(api_key="$YOUR_KEY", base_url="https://api.neuraldeep.tech/v1")

tools = [{
  "type": "function",
  "function": {
    "name": "get_weather",
    "description": "Gets the weather in a city",
    "parameters": {
      "type": "object",
      "properties": {"city": {"type": "string"}},
      "required": ["city"],
    }
  }
}]

messages = [{"role":"user","content":"What's the weather in Moscow?"}]
r = client.chat.completions.create(
    model="gpt-oss-120b",
    messages=messages,
    tools=tools,
    tool_choice="auto",
)
# r.choices[0].message.tool_calls → list of calls
```

```bash
curl https://api.neuraldeep.tech/v1/chat/completions \
  -H "Authorization: Bearer $YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model":"gpt-oss-120b",
    "messages":[{"role":"user","content":"tell a short story"}],
    "stream": true,
    "max_tokens": 800
  }'
```

> For repeated agent iterations use `user: session_id` so the session lives on one upstream — prefix caching saves up to 10× on tokens.

#### Coding agents · coddy

[coddy](https://coddy.dev) - an open-source agent in a single static Go binary: a console, an ACP server for VS Code and Zed, an HTTP gateway with a bundled web UI, and Telegram. NeuralDeep is not "yet another OpenAI-compatible provider" for it but a provider type of its own: the key comes from signing in to the hub, and the agent reads what is left of your limits through our `GET /v1/limits` and keeps it in the footer (session and week windows, reset times, wallet).

```bash
curl -fsSL https://coddy.dev/install.sh | bash

# browser sign-in to the hub; on a headless machine the same login takes --device
coddy providers login neuraldeep
```

The login writes the provider and your plan's models into `~/.coddy/config.yaml` itself. A key can also be set by hand - it always wins over the stored login:

```yaml
providers:
  - name: "neuraldeep"
    type: "neuraldeep"
    api_key: "$YOUR_KEY"
    api_base: "https://api.neuraldeep.tech/v1"   # api.neuraldeep.tech/v1 for the Russian deployment

models:
  - model: "neuraldeep/qwen3.6-35b-a3b"
    max_tokens: 8192

agent:
  model: "neuraldeep/qwen3.6-35b-a3b"
```

Use the API endpoint shown in your dashboard. Skills from our catalog are read natively: `~/.agents/skills` is one of coddy's default `skills.dirs`, and that is where `npx skillsbd install -g` puts the packs. Timeouts and stream counts for your plan come out of the builder in "Agent settings".

#### OpenCode

[OpenCode](https://opencode.ai) reads its config from `~/.config/opencode/opencode.json`; an `opencode.json` in the project root overrides it. The [agent settings builder](https://neuraldeep.tech/docs/agent-config.md) assembles a ready file for your plan and options: pick opencode there and copy the result. OpenCode takes the key from the `NEURALDEEP_API_KEY` variable. If you already have a config, merge in the `provider.neuraldeep` block and the `model` and `small_model` fields.

#### Coding agents · OpenAI Codex CLI

[codex CLI](https://www.npmjs.com/package/@openai/codex) — a terminal coding agent from OpenAI. Works via `/v1/responses` (Responses API). On our side we've applied 3 vLLM file patches to support `custom` tool types and multi-turn validation (per issue [#33089](https://github.com/vllm-project/vllm/issues/33089)).

```toml
# ----------------- provider -----------------
[model_providers.neuraldeep]
name = "NeuralDeep Hub"
base_url = "https://api.neuraldeep.tech/v1"
wire_api = "responses"
experimental_bearer_token = "$YOUR_KEY"
# Alternative: env_key = "NEURALDEEP_API_KEY" + export in the shell

# ----------------- profiles -----------------
[profiles.neuraldeep]
model_provider = "neuraldeep"
model = "qwen3.6-35b-a3b"
# qwen3.6 → 256k ctx, native tool-calls, better for a large codebase

[profiles.neuraldeep-oss]
model_provider = "neuraldeep"
model = "gpt-oss-120b"
# gpt-oss-120b → 131k ctx, long reasoning
```

```bash
# TUI mode with qwen3.6
codex --profile neuraldeep

# or with gpt-oss-120b
codex --profile neuraldeep-oss

# adjust reasoning effort
codex --profile neuraldeep -c model_reasoning_effort=low
```

> **wire_api = "chat" is no longer supported** in newer codex (since late 2025). Only `"responses"`. If you see the error `Error loading config.toml: wire_api = "chat" is no longer supported` — switch to responses.
