Docs · Guides
Connect your tools
Most tools need three things: a base URL, your API key and a model id. This page gives them for the common ones. Start by creating a key, see authentication, and by picking a model id from models.
Claude Code#
export ANTHROPIC_BASE_URL="https://ai.shvia.org"
export ANTHROPIC_AUTH_TOKEN="your key"
export ANTHROPIC_MODEL="a model id from GET /v1/models"
claudeTo make it permanent, add these lines to your shell profile. Claude Code then talks to the gateway through /v1/messages, and the model you picked answers, which does not have to be an Anthropic model.
Claude Code sends settings that the gateway ignores, among them max_tokens and thinking, and images are dropped. Tool calls are translated between the two dialects. A single session can use many requests, so watch the request limit.
OpenAI SDKs and tools that use environment variables#
export OPENAI_BASE_URL="https://ai.shvia.org/v1"
export OPENAI_API_KEY="your key"Any program that reads those two variables will use the gateway, and you choose the model in the program. In code:
import os
from openai import OpenAI
client = OpenAI(base_url="https://ai.shvia.org/v1", api_key=os.environ["SHVIA_API_KEY"])import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://ai.shvia.org/v1", apiKey: process.env.SHVIA_API_KEY });client.chat.completions.create and client.models.list work, and so does client.responses.create for the stateless cases described in responses. client.models.retrieve, client.embeddings.create, client.completions.create and the image endpoints have no counterpart.
Anthropic SDKs#
import os
import anthropic
client = anthropic.Anthropic(base_url="https://ai.shvia.org", api_key=os.environ["SHVIA_API_KEY"])import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ baseURL: "https://ai.shvia.org", apiKey: process.env.SHVIA_API_KEY });Use a model id from the gateway in model. See messages for what is ignored.
Cline and Roo Code#
In the extension's settings, choose these values:
| Setting | Value |
|---|---|
| API Provider | OpenAI Compatible |
| Base URL | https://ai.shvia.org/v1 |
| API Key | your key |
| Model ID | a model id from GET /v1/models |
These tools talk to chat completions, which accepts only string content. If an extension reports a 422 that says a message content must be a string, it is sending content parts. Images are not supported on that endpoint.
Continue#
In Continue's configuration, add a model with the openai provider and the gateway as its API base:
{
"models": [
{
"title": "ShvIA",
"provider": "openai",
"model": "a model id from GET /v1/models",
"apiBase": "https://ai.shvia.org/v1",
"apiKey": "your key"
}
]
}Newer versions of Continue read a YAML file instead of JSON. The fields are the same: provider: openai, model, apiBase and apiKey. Where the file lives depends on your version.
curl#
curl https://ai.shvia.org/v1/chat/completions \
-H "Authorization: Bearer $SHVIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "a model id from GET /v1/models", "messages": [{"role": "user", "content": "hi"}]}'Let the app write the configuration#
The account page of the ShvIA web app has a "Connect my CLI" section. It lists the models of GET /v1/models, and prints the settings for Claude Code, Cline, Roo Code, Continue, the environment variables and curl, with a placeholder where the key goes. The desktop app can also save the settings on your computer for you, in the configuration file of the tool.
When something does not work#
| You see | Likely cause |
|---|---|
401 | the key is wrong, or expired, or its group has no API access. See authentication |
404 on /v1/v1/… | an Anthropic client with /v1 in its base URL |
422, content must be a string | a client that sends content parts to chat completions |
403 | a model your group may not use, or a quota that is used up. See rate limits and quotas |
| an answer from an unexpected model | a model name the gateway does not know, or a cloud model for which you have no key. See models |
429 | the request limit. Wait for Retry-After |