Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

156 linesCodeBlameRaw
1/**
2 * The AI providers a workspace can keep credentials for, as its AI page
3 * shows them: grouped (frontier labs and model platforms, then models it
4 * hosts itself), with a line each, a mark, and where to get a key.
5 */
6import { type AiGroup, type AiProvider, AI_PROVIDERS } from "@g1t/contracts/ai";
7
8/** How the AI page shows a provider; its name, group and API are the contracts' `AI_PROVIDERS`. */
9export type AiProviderLook = {
10 blurb: string;
11 /** The provider's colour, for its mark. */
12 color: string;
13 /** What the mark shows: an initial or two. Empty for an icon. */
14 mark: string;
15 /** Where to get a key. */
16 keyUrl?: string;
17 /** How to get one there, in a sentence or two, for someone who never has. */
18 keyHow?: string;
19 keyPlaceholder?: string;
20 /** A model to suggest. */
21 model?: string;
22};
23
24/** How each AI provider is shown. */
25export const AI_PROVIDER_LOOKS: Record<AiProvider, AiProviderLook> = {
26 anthropic: {
27 blurb: "Claude, on your own Anthropic key.",
28 color: "#d97757",
29 mark: "A",
30 keyUrl: "https://platform.claude.com/settings/keys",
31 keyPlaceholder: "sk-ant-…",
32 keyHow:
33 "Sign in to the Claude Console, choose Create key and copy it. The account needs credits under Billing; a Claude.ai subscription does not include the API.",
34 },
35 openai: {
36 blurb: "GPT and the o-series, on your own OpenAI key.",
37 color: "#10a37f",
38 mark: "O",
39 keyUrl: "https://platform.openai.com/api-keys",
40 keyPlaceholder: "sk-…",
41 model: "gpt-5",
42 keyHow: "Choose Create new secret key and copy it. The API needs credit under Settings → Billing; a ChatGPT subscription does not include it.",
43 },
44 gemini: {
45 blurb: "Gemini, on your own Google AI Studio key.",
46 color: "#4285f4",
47 mark: "G",
48 keyUrl: "https://aistudio.google.com/apikey",
49 model: "gemini-2.5-pro",
50 keyHow: "Sign in with a Google account, choose Create API key and copy it. The free tier needs no card.",
51 },
52 xai: {
53 blurb: "Grok, on your own xAI key.",
54 color: "#e5e5e5",
55 mark: "x",
56 keyUrl: "https://console.x.ai",
57 keyPlaceholder: "xai-…",
58 model: "grok-4",
59 keyHow: "Open API Keys, choose Create API key and copy it. The team needs credits under Billing.",
60 },
61 mistral: {
62 blurb: "Mistral and Codestral, on your own key.",
63 color: "#fa520f",
64 mark: "M",
65 keyUrl: "https://console.mistral.ai/api-keys",
66 model: "mistral-large-latest",
67 keyHow: "Choose Create new key and copy it. The workspace needs a plan under Billing; the free Experiment plan works.",
68 },
69 deepseek: {
70 blurb: "DeepSeek's chat and reasoning models.",
71 color: "#4d6bfe",
72 mark: "D",
73 keyUrl: "https://platform.deepseek.com/api_keys",
74 keyPlaceholder: "sk-…",
75 model: "deepseek-chat",
76 keyHow: "Choose Create new API key and copy it. The account needs a balance under Top up.",
77 },
78 azure_openai: {
79 blurb: "OpenAI's models on your own Azure resource and contract.",
80 color: "#0078d4",
81 mark: "Az",
82 keyUrl: "https://portal.azure.com",
83 keyHow:
84 "Open your Azure OpenAI resource, then Resource Management → Keys and Endpoint: copy KEY 1 and the endpoint. Deployments are listed in the Azure AI Foundry portal.",
85 },
86 openrouter: {
87 blurb: "Hundreds of models from every lab, on one key.",
88 color: "#7c7ff5",
89 mark: "OR",
90 keyUrl: "https://openrouter.ai/keys",
91 keyPlaceholder: "sk-or-…",
92 model: "anthropic/claude-sonnet-4.5",
93 keyHow: "Choose Create Key and copy it. Paid models need credits under Credits.",
94 },
95 groq: {
96 blurb: "Open models at very high speed.",
97 color: "#f55036",
98 mark: "Gq",
99 keyUrl: "https://console.groq.com/keys",
100 keyPlaceholder: "gsk_…",
101 model: "moonshotai/kimi-k2-instruct",
102 keyHow: "Choose Create API Key and copy it. The free tier needs no card.",
103 },
104 together: {
105 blurb: "Open models: Llama, Qwen, DeepSeek, Kimi.",
106 color: "#0f6fff",
107 mark: "T",
108 keyUrl: "https://api.together.ai/settings/api-keys",
109 model: "Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8",
110 keyHow: "Copy the key shown there, or create one.",
111 },
112 fireworks: {
113 blurb: "Fast open models, and your own fine-tunes.",
114 color: "#7c3aed",
115 mark: "F",
116 keyUrl: "https://fireworks.ai/account/api-keys",
117 model: "accounts/fireworks/models/kimi-k2-instruct",
118 keyHow: "Choose Create API Key and copy it.",
119 },
120 cerebras: {
121 blurb: "Open models on wafer-scale chips.",
122 color: "#f05a28",
123 mark: "C",
124 keyUrl: "https://cloud.cerebras.ai",
125 keyPlaceholder: "csk-…",
126 model: "qwen-3-coder-480b",
127 keyHow: "Open API Keys, choose Generate API Key and copy it.",
128 },
129 anthropic_endpoint: {
130 blurb: "Anything that speaks Anthropic's API: your own gateway, LiteLLM, Bedrock or Vertex behind a proxy.",
131 color: "#a1a1aa",
132 mark: "",
133 },
134 openai_endpoint: {
135 blurb: "Anything that speaks OpenAI's API: vLLM, Ollama behind a tunnel, LiteLLM, a gateway.",
136 color: "#a1a1aa",
137 mark: "",
138 },
139};
140
141/** The groups, in the order people are shown them. */
142export const AI_PROVIDER_GROUPS: { group: AiGroup; title: string }[] = [
143 { group: "labs", title: "Frontier labs" },
144 { group: "platforms", title: "Model platforms" },
145 { group: "self_hosted", title: "Self-hosted or your own gateway" },
146];
147
148/** The AI providers in one group, in catalogue order. */
149export function aiProvidersIn(group: AiGroup): AiProvider[] {
150 return (Object.keys(AI_PROVIDERS) as AiProvider[]).filter((provider) => AI_PROVIDERS[provider].group === group);
151}
152
153/** Whether a provider is one whose own endpoint the workspace gives. */
154export function isEndpoint(provider: AiProvider): boolean {
155 return AI_PROVIDERS[provider].group === "self_hosted";
156}