Skip to content

Models

The models

Models I trained myself. Try them in the terminal, or call them from your own code through one API.

Ophyx 350M ophyx-350m-v2

My own code model, trained from scratch on free compute. It writes Python functions.

Use the APIOne key, OpenAI's format. Open for the steps.

The API speaks OpenAI's chat completions format at https://api.abhashchakraborty.tech/v1, so the OpenAI SDKs work with it. Every request needs only your key.

1. Get a key

Run api key in the terminal. It checks your browser, then shows the key once with the commands below. One key per person: a new key switches the old one off, and every key stops working 3 hours after it's made.

2. Keep it in your shell

Linux and macOS:

export ABHASH_API_KEY="<your key>"

Windows PowerShell:

$env:ABHASH_API_KEY = "<your key>"

3. Ask a model

curl https://api.abhashchakraborty.tech/v1/chat/completions \
  -H "Authorization: Bearer $ABHASH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"ophyx-350m-v2","messages":[{"role":"user","content":"Write is_palindrome(s)"}]}'

In Windows PowerShell, where curl is a different command:

$body = @{
  model = "ophyx-350m-v2"
  messages = @(@{ role = "user"; content = "Write is_palindrome(s)" })
} | ConvertTo-Json -Depth 4
$reply = Invoke-RestMethod -Method Post -Uri "https://api.abhashchakraborty.tech/v1/chat/completions" `
  -Headers @{ Authorization = "Bearer $env:ABHASH_API_KEY" } `
  -ContentType "application/json" -Body $body
$reply.choices[0].message.content

Stream the answer as it's written:

curl -N https://api.abhashchakraborty.tech/v1/chat/completions \
  -H "Authorization: Bearer $ABHASH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"ophyx-350m-v2","stream":true,"messages":[{"role":"user","content":"Write is_palindrome(s)"}]}'

With the OpenAI SDK for Python (pip install openai):

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.abhashchakraborty.tech/v1", api_key=os.environ["ABHASH_API_KEY"])
reply = client.chat.completions.create(
    model="ophyx-350m-v2",
    messages=[{"role": "user", "content": "Write is_palindrome(s)"}],
)
print(reply.choices[0].message.content)

From JavaScript or TypeScript, with no SDK:

const res = await fetch("https://api.abhashchakraborty.tech/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ABHASH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "ophyx-350m-v2",
    messages: [{ role: "user", content: "Write is_palindrome(s)" }],
  }),
});
const data = await res.json();
console.log(data.choices[0].message.content);

The models this API serves right now:

curl https://api.abhashchakraborty.tech/v1/models

Request body

  • model: required, an id from /v1/models
  • messages: the whole conversation: earlier user and assistant turns reach the model, so follow-ups work, and it keeps the newest that fit its context. System messages are ignored. The last user message can be up to 2,000 characters
  • max_tokens: up to 768, the default
  • temperature: 0 to 1.5, default 0.2
  • stream: true for server-sent events; add "stream_options":{"include_usage":true} for token counts at the end
  • concise: true by default: plain code with few comments. Send false for docstrings and comments

Limits

  • One request at a time per key; 5 a minute, 50 an hour and 100 a day.
  • Each day a key also shares its owner's 60 messages with the terminal chat, and the whole site has a daily cap, after which the API rests until midnight UTC.

Errors

Errors use OpenAI's shape, { error: { message, type, code } }, and the message says what to do.

  • 401 invalid_api_key · key_expired: run api key for a new one
  • 404 model_not_found: check the id against /v1/models
  • 429 concurrent_requests · rate_limit_exceeded: wait for the time in Retry-After
  • 503 api_off · model_offline: the API or that model is switched off

Try it

Asleep

My own code model, trained from scratch on free compute. It writes Python functions.

Follow-ups see earlier answers. Nothing is stored.

What's kept

Prompts and answers are never stored or logged. Each answer leaves its size, timing and model in the usage numbers, and keys are kept only as one-way codes. The privacy page has the details.