Use one OpenAI-compatible AI endpoint with plan-based routing profiles, bearer-token access, and predictable daily/monthly prompt quotas.
Current planFree
Smart-Route Mini · Standard
Daily remaining200
of 200 prompts
Monthly remaining1000
of 1000 prompts
Public modelsmart-route-mini
Free routing profile
Model catalog
All public model aliases
Use any listed public alias in the model field. The active subscription controls the strongest routing profile, quota, and speed available for the request without exposing internal provider details.
AliasPublic namePlan tierBest fit
smart-route-miniSmart-Route MiniFreeCompact smart routing for quick prompts and lightweight automation.
smart-routeSmart-RoutePlusStandard smart routing for everyday API usage.
smart-route-focusSmart-Route FocusBusinessStronger planning profile for business workflows and more detailed prompts.
smart-route-deepSmart-Route DeepProDeep reasoning profile for heavier generation, analysis, and coding support.
smart-route-ultraSmart-Route UltraUltimateHigh-depth routing profile for complex work with larger prompt volumes.
smart-route-turboSmart-Route TurboMaxFast premium routing profile for high-volume teams.
smart-route-infiniteSmart-Route InfiniteUnlimitedTop routing profile for unrestricted prompt volume and priority workflows.
https://ai.mihajlo.mk/api/smart-routing-ai-model/v1/models returns the same aliases with API capability metadata. Higher plans can still request lower aliases when you want a lighter profile for simple work.
AuthorizationUse Bearer {serviceTokenHere} in the request header.
modelAny public model alias can be sent; the active plan controls the actual routing profile.
messagesRequired array of chat messages in the usual role/content format.
streamSupported on /v1/chat/completions, /v1/completions, and /v1/responses. Chat clients receive OpenAI-style chat.completion.chunk events; Codex-compatible agent clients should use /v1/responses.
Live tester
Test a chat request
Login to run live OpenAI-compatible requests from the documentation page. Endpoint examples and provider setup remain visible below.
Smart AI Agent is a free VS Code extension for this Smart Routing model. Install it from the Visual Studio Marketplace, then copy the service token from this documentation page into the extension token dialog.
curl https://ai.mihajlo.mk/api/smart-routing-ai-model/v1/responses \
-H "Authorization: Bearer {serviceTokenHere}" \
-H "Content-Type: application/json" \
-d '{
"model": "smart-route-mini",
"stream": true,
"input": "Inspect the repository and suggest the next safe step."
}'
The stream emits Responses API events such as response.created, response.output_text.delta, response.output_text.done, and response.completed. When a Codex-compatible client sends local tools, Smart Routing can also emit function_call items and then continue after the client sends back function_call_output.
Agent mode
How Codex CLI uses local tools
RequestCodex CLI sends /v1/responses requests with stream: true, conversation context, and available local tools such as shell execution.
Tool callSmart Routing returns a Responses-compatible function_call event when the next step requires a local command or another client-side tool.
Local executionCodex CLI executes that tool on your own machine, inside the workspace and sandbox rules configured in your Codex CLI session.
ContinuationCodex CLI sends the tool result back as function_call_output. Smart Routing then decides whether to call another tool or return the final answer.
This is the mode to use when you want Smart Routing to work as an agent for coding tasks. The API token only authenticates your Smart Routing service usage; local file access and command execution remain controlled by your Codex CLI configuration.
Higher plans are meant for more serious agent work: stronger public routing profiles, larger prompt budgets, and faster execution where the plan includes it.
Codex CLI setup
Use as an external compatible endpoint
Codex supports custom model providers in the user-level ~/.codex/config.toml. Add a provider that points to this API base URL and stores your token in an environment variable.
Use wire_api = "responses" for Codex CLI. Smart Routing supports SSE streaming, function_call events, and function_call_output continuations on /v1/responses, which is what Codex-compatible agent clients need.
Codex permissions
Sandbox, approvals, and dangerous modes
These options are passed to your local Codex CLI. Smart Routing only provides the model endpoint; command execution permissions are controlled by the CLI process on your machine.
-s read-onlySafest sandbox mode. The agent can inspect files and run read-style commands, but cannot write into the workspace. Use for audits, explanations, and first tests.
-s workspace-writeAllows edits inside the active workspace. Use for normal coding tasks when you want Codex to create or modify project files.
-s danger-full-accessNo filesystem sandbox restriction from Codex. Use only in a disposable or trusted project folder when the agent must install packages, write broadly, or run heavier local commands.
--dangerously-bypass-approvals-and-sandboxSkips approval prompts and runs without sandboxing. This is the most permissive mode and should be used only in externally isolated test folders.
--dangerously-bypass-hook-trustAllows enabled hooks without persisted hook trust for this invocation. Use only for automation where hooks are already reviewed and trusted.
--add-dir <DIR>Adds another writable directory alongside the primary workspace. Useful when a test project needs access to a shared local package or generated output folder.
-C, --cd <DIR>Sets the workspace root used by the agent. Always pass this when testing so Codex writes into the expected folder.
If Linux sandboxing fails with bwrap or RTM_NEWADDR, the issue is local sandbox support. For a quick disposable test, use --dangerously-bypass-approvals-and-sandbox; for daily work, fix local sandbox/user namespace support or run in a properly isolated environment.
Approval policies
How Codex asks before running commands
-a untrustedOnly trusted/simple commands run without asking. Commands outside that trusted set ask for approval. Good for cautious interactive work.
-a on-requestThe model decides when approval is needed. This is practical for interactive sessions where you can approve selected actions.
-a neverNever asks for approval. Failures are returned to the model immediately. Use for non-interactive tests or when combined with a trusted sandbox mode.
-a on-failureDeprecated in the local Codex CLI help. Prefer on-request for interactive runs or never for non-interactive runs.
Launch profiles
Recommended Codex commands
Safe inspectionUse this for the first test when you only want Codex to inspect files and explain what it would do.
Non-interactive agent testUseful for smoke tests and scripted prompts. Add --skip-git-repo-check when the folder is not a Git repository.
CODEX_HOME="$HOME/codex-ai-tools-test-home" codex exec \
--skip-git-repo-check \
-C "$PWD" \
-m smart-route-mini \
-s workspace-write \
-a never \
"Create hello.txt and then verify it exists."
YOLO disposable testUse only in an isolated temporary folder. This avoids local sandbox prompts and is useful when Linux bwrap blocks tool execution.
--skip-git-repo-checkFor codex exec. Allows running in a folder that is not a Git repository.
--ephemeralFor codex exec. Runs without persisting session files to disk.
--ignore-user-configFor codex exec. Ignores $CODEX_HOME/config.toml; useful when testing whether config is causing a problem.
--ignore-rulesFor codex exec. Ignores user/project exec policy rule files for that invocation.
--searchInteractive CLI option that enables the native web search tool if the active provider/client setup supports it.
-c key=valueOverrides a config value for one run. Codex help includes examples such as -c 'sandbox_permissions=["disk-full-read-access"]' and -c shell_environment_policy.inherit=all.
codex sandbox linux|macos|windowsRuns a command directly inside a Codex-provided platform sandbox. Useful for diagnosing local sandbox behavior, separate from Smart Routing API calls.
--permissions-profile <NAME>Used with codex sandbox subcommands to apply a named permissions profile from the active local configuration stack.
Agent smoke test
Try it in a disposable folder
Use a separate CODEX_HOME and a temporary project folder when testing a new provider setup. This keeps your main Codex configuration untouched.
mkdir -p ~/codex-ai-tools-test-home ~/codex-ai-tools-test-project
export AI_TOOLS_ROUTER_API_KEY="{serviceTokenHere}"
CODEX_HOME=~/codex-ai-tools-test-home codex exec \
--skip-git-repo-check \
--dangerously-bypass-approvals-and-sandbox \
-C ~/codex-ai-tools-test-project \
-m smart-route-mini \
"Run pwd with the shell tool, then create hello.txt with a short hello message."
Expected behaviorCodex should show a command/tool execution item, then create hello.txt in ~/codex-ai-tools-test-project.
Model metadata warningIf Codex says the custom model alias is not in its local catalog, that is only a local warning. The endpoint can still work.
Missing environment variableIf Codex says Missing environment variable, set env_key = "AI_TOOLS_ROUTER_API_KEY" in config and export your token into that variable.
Sandbox behaviorIf Linux shows bwrap or RTM_NEWADDR errors, that is a local Codex sandbox/user-namespace issue. For a disposable test folder, use --dangerously-bypass-approvals-and-sandbox; for normal use, configure your local Linux sandbox correctly.
Stale session contextAfter changing provider config or sandbox flags, start a fresh Codex session so old tool failures are not kept in the conversation history.
Agent qualityIf a task is too sparse, use a higher public model alias allowed by your plan and give explicit file/detail requirements. Larger plans are tuned for deeper multi-step work.
Troubleshooting
Common Codex setup messages
Model metadata ... not foundCodex does not know this custom alias locally, so it uses fallback metadata. The request can still run through Smart Routing.
Missing environment variableThe config must contain env_key = "AI_TOOLS_ROUTER_API_KEY". Do not paste the token as the env key name; export the token into that variable.
bwrap: loopbackThis comes from the local Codex sandbox, not from the API. Use the bypass flag only for disposable test folders or fix user namespaces on the machine.
No local file changesConfirm the command includes -C "$PWD" or -C /path/to/project, and that Codex is started inside the intended workspace.
Short/scaffold-only outputUse a stronger public alias from your plan, make the request concrete, and keep the session fresh. The agent route now supports longer decision turns for larger scaffolding tasks.
Kilo Code setup
Provider fields
ProviderOpenAI Compatible
Base URLhttps://ai.mihajlo.mk/api/smart-routing-ai-model/v1
API keyYour Smart Routing AI Model service token from this page.
Modelsmart-route-mini or any public alias listed by /v1/models.
Upgrade
Need more prompt capacity?
Choose a larger Smart Routing AI Model plan when daily or monthly prompt volume grows.