Claude Code
Claude Code can use NexoAI through the Anthropic-compatible API shape. Store the gateway and key in Claude Code's user-level settings.json, then launch claude normally.
Locate settings.json
| Platform | User settings path |
|---|---|
| macOS | ~/.claude/settings.json |
| Linux | ~/.claude/settings.json |
| Windows | %USERPROFILE%\.claude\settings.json |
Create the .claude directory and file if they do not exist. If the file already contains settings, add the env object without deleting the other keys and keep the result valid JSON.
Configure NexoAI
json
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.nexoai.ma",
"ANTHROPIC_AUTH_TOKEN": "sk-your-key"
}
}Replace sk-your-key with a named virtual key from the NexoAI dashboard. Claude Code reads this environment block when it starts, so restart any running session after editing the file.
This file contains a live secret
Do not commit ~/.claude/settings.json, paste it into an issue, or share the complete file in a screen recording. If the key leaks, revoke it in the NexoAI dashboard.
Run Claude Code
Open a terminal in the repository you want Claude Code to work with:
bash
claudeStart with a small prompt that only needs to inspect the project. Then check the NexoAI dashboard's usage view to confirm that the request used the intended key and wallet.
Project-specific configuration
Claude Code can also read project settings under .claude/. Avoid putting a real key in a repository-level file. Keep credentials in your user settings or inject them from a secret manager, and use project settings only for non-secret behavior.
Troubleshooting
Authentication error
Confirm that the setting is named ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY, and that the base is exactly https://api.nexoai.ma. Recopy the key if whitespace may have been added.
Model not found
First verify that the credential is the NexoAI key you intended to use. A stale, revoked, or wrong key can surface as a model-access failure. Then compare the model ID with the current catalog and check that it was not misspelled.
“Model not found” often starts with the key
Before changing model names at random, verify the active key and gateway. A client still pointed at a vendor endpoint will not recognize NexoAI catalog IDs.
Rate or budget error
Review the key's RPM, TPM, and budget caps, then the shared wallet balance. A limit error should be fixed by adjusting the relevant cap or workload—not by creating many unbounded keys.
Next: configure Codex →
