Claude Code Guide
Set up Flaq AI Claude models and explore Claude Code skills
Try Claude Sonnet 5.5 API by Anthropic for text reasoning, writing, coding, and analysis through Flaq AI's stable, affordable API with streaming responses.
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
Accept: 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'claude-sonnet-5.5-text-to-text',
messages: [
{
role: 'user',
content: 'Write a four-line modern poem about a programmer drinking coffee.'
}
],
stream: true,
max_tokens: 500,
})
});
if (!response.ok) {
const errorBody = await response.json().catch(() => null);
throw new Error(errorBody?.error?.message ?? errorBody?.message ?? `HTTP ${response.status}`);
}
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
let assistantText = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const frames = buffer.split(/\r?\n\r?\n/);
buffer = frames.pop() || '';
for (const frame of frames) {
const lines = frame.split(/\r?\n/).filter(Boolean);
let eventName = 'message';
const dataLines = [];
for (const line of lines) {
if (line.startsWith('event:')) {
eventName = line.slice(6).trim();
} else if (line.startsWith('data:')) {
dataLines.push(line.replace(/^data:\s*/, ''));
}
}
const raw = dataLines.join('\n').trim();
if (raw === '[DONE]') {
console.log('\nFinal text:', assistantText);
continue;
}
let payload;
try {
payload = JSON.parse(raw);
} catch {
continue;
}
if (eventName === 'error' || payload.error) {
const msg = payload.error?.message ?? payload.message ?? 'Chat request failed';
throw new Error(msg);
}
const delta = payload.choices?.[0]?.delta;
if (delta?.content) {
assistantText += delta.content;
console.log(assistantText);
}
}
}
import json
import requests
response = requests.post(
'https://api.flaq.ai/api/v1/chat/completions',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json',
},
json={
'model': 'claude-sonnet-5.5-text-to-text',
'messages': [
{
'role': 'user',
'content': 'Write a four-line modern poem about a programmer drinking coffee.',
}
],
'stream': True,
'max_tokens': 500,
},
stream=True,
)
response.raise_for_status()
event_name = 'message'
assistant_text = ''
for raw_line in response.iter_lines(decode_unicode=True):
if not raw_line:
event_name = 'message'
continue
if raw_line.startswith('event:'):
event_name = raw_line.replace('event:', '', 1).strip()
continue
if raw_line.startswith('data:'):
raw_data = raw_line.replace('data:', '', 1).strip()
if raw_data == '[DONE]':
print('\nFinal text:', assistant_text)
continue
payload = json.loads(raw_data)
if event_name == 'error' or payload.get('error'):
error = payload.get('error') or payload
raise RuntimeError(error.get('message', 'Chat request failed'))
choices = payload.get('choices') or []
if choices:
delta = choices[0].get('delta') or {}
content = delta.get('content')
if content:
assistant_text += content
print(content, end='', flush=True)
curl -N -X POST "https://api.flaq.ai/api/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5.5-text-to-text",
"messages": [
{
"role": "user",
"content": "Write a four-line modern poem about a programmer drinking coffee."
}
],
"stream": true,
"max_tokens": 500
}'
| Parameters | Price | Original Price | Discount |
|---|
Claude Sonnet 5.5 Text-to-Text API brings Anthropic's language model to message-based writing and conversation workflows on Flaq AI. Developers can turn instructions and supplied context into draft copy, summaries, explanations, and follow-up answers through a dedicated text generation API. Streaming responses and adjustable output length help integrate Claude Sonnet 5.5 into chat interfaces, editorial tools, and internal assistants without adding attachment handling to a text-only workflow.
Instruction-Based Text Generation: Describe the task, audience, and desired format to request original drafts, rewritten passages, or focused answers from the Claude Sonnet 5.5 API.
Conversation Context: Include relevant earlier messages so follow-up requests can refer to the same brief, terminology, and source material.
Streaming Responses: Receive generated text progressively for chat and writing interfaces that display an answer as it is produced.
Flexible Output Length: Set an output token limit to suit short replies or more detailed explanations, alongside natural-language guidance about the desired length.
Iterative Writing Support: Refine a draft through successive messages, asking for changes to tone, organization, or emphasis without restating the entire brief.
Focused Text Integration: Use a dedicated text-only route for workflows whose source material is already available as message content.
Input: Text messages containing instructions, source passages, and relevant conversation history.
Output: Generated text returned as a complete response or progressively through streaming.
Controls: An optional output token limit and a choice of streamed or non-streamed delivery.
Capabilities: Conversational answers, drafting, rewriting, summarization, and explanations based on the text supplied in the request.
Writing Assistants: Build editors that help users develop outlines, rewrite paragraphs, and adapt existing copy to a different audience.
Support Reply Drafts: Provide the relevant product information and customer question to produce a response for review.
Knowledge Summaries: Turn supplied meeting notes or reference passages into concise summaries and action-oriented briefs.
Learning Tools: Let users ask for an explanation and then clarify individual points through follow-up messages.
Internal Workflow Automation: Generate text for recurring reports and structured briefs from application-provided context.
Note Keep the instructions and relevant source text in the request, and review factual statements before publication. Use the File Analysis route when the task depends on uploaded documents.
Claude Sonnet 5.5 Text-to-Text vs. GPT 6.1 Sol Text-to-Text Both routes support message-based text generation and streaming on Flaq AI. Compare their responses to your own writing briefs and conversation tests when selecting a model for your application.
Claude Sonnet 5.5 Text-to-Text vs. Claude Sonnet 5.5 File Analysis The text-only route takes its source material from messages. File Analysis adds attachment input for workflows that begin with documents or images.
Claude Sonnet 5.5 Text-to-Text vs. GPT 6.1 Sol Web Search Web Search is a separate option for research that calls for online information. Claude Sonnet 5.5 Text-to-Text is configured for conversation without web search.
Claude Sonnet 5.5 Text-to-Text vs. GPT 6.1 Sol Image-to-Text Image-to-Text accepts visual input for questions about a picture. This Claude route is intended for instructions and source content expressed as text.
Set up Flaq AI Claude models and explore Claude Code skills

Set up Flaq AI GPT models and explore Codex skills
Use Flaq AI LLM models in Hermes Agent
Use GLM 5.2, Kimi K3, and DeepSeek v4 in ZCode
Run DeepSeek Harness with Flaq AI DeepSeek models
Connect AI agents to Flaq image and video generation tools
Use GPT 6 Astra and Claude Fable 5.1 in WorkBuddy