API and SDKs
Modelway speaks the Anthropic and OpenAI APIs. Use the official SDKs or plain HTTP with Modelway’s base URL and your key.
Get your Modelway key
Sign in, open API keys and click Create key. Copy it right away: it’s shown once. New to Modelway? Start with getting access.
Keep the key in your environment
So it stays out of your code:
export MODELWAY_API_KEY="<your Modelway API key>"
This lasts until you close the terminal. To keep it, add the line to ~/.zshrc or ~/.bashrc.
Send a request
An Anthropic Messages request:
1curl https://modelway.vip/v1/messages \2 -H "Authorization: Bearer $MODELWAY_API_KEY" \3 -H "anthropic-version: 2023-06-01" \4 -H "content-type: application/json" \5 -d '{"model": "claude-sonnet-5.5", "max_tokens": 256, "messages": [{"role": "user", "content": "Hello"}]}'
OpenAI’s Chat Completions and Responses work the same way at /v1/chat/completions and /v1/responses. Streaming works on all three.
Use the Anthropic SDK
Pass Modelway’s URL, without /v1, as the base URL:
1import os2from anthropic import Anthropic34client = Anthropic(5 base_url="https://modelway.vip",6 api_key=os.environ["MODELWAY_API_KEY"],7)8message = client.messages.create(9 model="claude-sonnet-5.5",10 max_tokens=1024,11 messages=[{"role": "user", "content": "Hello"}],12)13print(message.content[0].text)
The TypeScript SDK takes the same values as baseURL and apiKey.
Use the OpenAI SDK
Pass Modelway’s URL with /v1:
1import os2from openai import OpenAI34client = OpenAI(5 base_url="https://modelway.vip/v1",6 api_key=os.environ["MODELWAY_API_KEY"],7)8response = client.responses.create(model="claude-sonnet-5.5", input="Hello")9print(response.output_text)
client.chat.completions.create works too, with any model in the catalog, Claude included.
List the models
The catalog, in OpenAI’s format:
curl https://modelway.vip/v1/models -H "Authorization: Bearer $MODELWAY_API_KEY"
FAQ
Which header does the key go in?
Either one: Authorization: Bearer or x-api-key. The SDKs pick one for you.
Can I call GPT models through the Anthropic API?
Yes. Every endpoint serves every model in the catalog, so pick the API your code already uses.