Claude Code · Client
Connect Claude Code to Tikway: environment setup and first-request checks
Last updated:
Claude Code’s configuration differs from an ordinary OpenAI SDK client. Choose a Claude model supporting Anthropic Messages in Tikway’s catalog, confirm its exact ID, test text in an isolated environment, then check coding tasks and tool execution.
One text answer does not establish that every Claude Code feature works. Client versions, model capabilities and account permissions can affect results.
1. Confirm the protocol and base URL
Tikway’s complete Messages endpoint is https://api.tikway.ai/v1/messages. Set Claude Code’s ANTHROPIC_BASE_URL to https://api.tikway.ai; the client appends the operation path. Do not include /v1/messages in the base URL.
Read the Messages example and check Anthropic support, endpoint and ID in the catalog. A non-Claude model returning text through a different protocol does not demonstrate suitability for Claude Code.
2. Configure an isolated session
The Bash example works on macOS, Linux or WSL. Install Claude Code using its installation instructions, record claude --version, and check flags using the installed CLI’s claude --help.
export TIKWAY_API_KEY='YOUR_TIKWAY_API_KEY'
export TIKWAY_MODEL='CLAUDE_MODEL_ID_FROM_CATALOG'
(
unset ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_BASE_URL='https://api.tikway.ai'
export ANTHROPIC_API_KEY="$TIKWAY_API_KEY"
claude --model "$TIKWAY_MODEL"
)
The parenthesized configuration applies only to the subshell and does not edit global files. It uses API-key authentication and unsets a potentially conflicting ANTHROPIC_AUTH_TOKEN. If managed organization settings or apiKeyHelper already exist, check them first and follow their provider restrictions.
For Windows, use a new temporary PowerShell terminal:
$env:ANTHROPIC_BASE_URL = 'https://api.tikway.ai'
$env:ANTHROPIC_API_KEY = 'YOUR_TIKWAY_API_KEY'
Remove-Item Env:ANTHROPIC_AUTH_TOKEN -ErrorAction SilentlyContinue
claude --model 'CLAUDE_MODEL_ID_FROM_CATALOG'
These session variables end when that terminal closes. Keep real keys out of project files and public screenshots. Gateway requests follow Tikway’s account and model billing rules; another product subscription does not make them automatically free.
3. Validate the first request in three steps
- Start in an empty temporary directory and send a short prompt such as “Reply only with OK”. Check for authentication and model errors.
- Match time, model and protocol in Tikway’s request records to confirm the expected account.
- Test a harmless read-only tool operation in a temporary project, then a representative coding task. Record text, streaming and tool results separately.
Each step checks a different property. Long sessions, tool-result handling, MCP and project-specific behavior need their own validation.
4. Why does curl work while Claude Code fails?
Confirm curl tested /v1/messages. Success at /v1/chat/completions does not verify an Anthropic request.
| Symptom | Check first |
|---|---|
| 401 or 403 | Key, authentication variables, base URL and organization policy. |
| Model not found | Exact ID, Anthropic protocol and account access. |
| CLI works but IDE fails | Whether the IDE process reads the new environment or retains old settings. |
| Text works but tools fail | Tool support, arguments and result protocol in addition to authentication. |
| Long sessions disconnect | Events, timeouts and proxy settings; see streaming troubleshooting. |
Report client version, OS, model ID, time/timezone, HTTP status and available request ID. Remove authentication and private project content.
5. Choose models and control costs
Use the coding model selection guide to identify capabilities and context needs, then the cost calculator. A coding session can include history, tool definitions and results; input is larger than the latest user message alone.
References: Claude Code gateway documentation · 401 troubleshooting · Model and billing checks